elastic/elasticsearch · error · GradleException

Gradle {minimumGradleVersion}+ is required

Error message

Gradle {minimumGradleVersion}+ is required

What it means

Thrown by GlobalBuildInfoPlugin.apply(Project) when the running Gradle version is older than the minimum required version. The minimum version is read from the classpath resource '/minimumGradleVersion' and compared via GradleVersion.current().compareTo(minimumGradleVersion) < 0. This ensures the build runs on a Gradle version compatible with all build logic.

Source

Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/GlobalBuildInfoPlugin.java:123

        this.providers = providers;
        this.buildFeatures = buildFeatures;
    }

    @Override
    public void apply(Project project) {
        if (project != project.getRootProject()) {
            throw new IllegalStateException(this.getClass().getName() + " can only be applied to the root project.");
        }
        this.project = project;
        project.getPlugins().apply(JvmToolchainsPlugin.class);
        project.getPlugins().apply(JdkDownloadPlugin.class);
        project.getPlugins().apply(VersionPropertiesPlugin.class);
        Provider<GitInfo> gitInfo = project.getPlugins().apply(GitInfoPlugin.class).getGitInfo();

        toolChainService = project.getExtensions().getByType(JavaToolchainService.class);
        GradleVersion minimumGradleVersion = GradleVersion.version(getResourceContents("/minimumGradleVersion"));
        if (GradleVersion.current().compareTo(minimumGradleVersion) < 0) {
            throw new GradleException("Gradle " + minimumGradleVersion.getVersion() + "+ is required");
        }

        Properties versionProperties = (Properties) project.getExtensions().getByName(VERSIONS_EXT);
        JavaVersion minimumCompilerVersion = JavaVersion.toVersion(versionProperties.get("minimumCompilerJava"));
        JavaVersion minimumRuntimeVersion = JavaVersion.toVersion(versionProperties.get("minimumRuntimeJava"));
        Version elasticsearchVersionProperty = Version.fromString(versionProperties.getProperty("elasticsearch"));

        RuntimeJava runtimeJavaHome = findRuntimeJavaHome();
        AtomicReference<BwcVersions> cache = new AtomicReference<>();
        Provider<BwcVersions> bwcVersionsProvider = providers.provider(
            () -> cache.updateAndGet(val -> val == null ? resolveBwcVersions(elasticsearchVersionProperty) : val)
        );

        BuildParameterExtension buildParams = project.getExtensions()
            .create(
                BuildParameterExtension.class,
                BuildParameterExtension.EXTENSION_NAME,
                DefaultBuildParameterExtension.class,

View on GitHub (pinned to db6a809a66)

Solutions

  1. Always use the Gradle wrapper: ./gradlew <task> instead of system gradle.
  2. Update gradle/wrapper/gradle-wrapper.properties to match or exceed the minimum version if you intentionally changed the minimum.
  3. In IntelliJ, go to Settings > Build Tools > Gradle and set 'Gradle wrapper' as the default, or update the Gradle SDK path.
  4. Run gradle --version to check the current version if using a system Gradle.

Example fix

# before (system gradle too old)
gradle build  # Gradle 8.5

# after (use wrapper)
./gradlew build  # uses version from gradle-wrapper.properties
Defensive patterns

Strategy: validation

Validate before calling

// Pre-build check: verify Gradle version
GradleVersion minimum = GradleVersion.version(new String(
    getClass().getResourceAsStream('/minimumGradleVersion').readAllBytes()).trim());
if (GradleVersion.current().compareTo(minimum) < 0) {
    throw new GradleException("Use ./gradlew wrapper or upgrade Gradle to " + minimum);
}

Prevention

When it happens

Trigger: The developer or CI agent invokes the Gradle wrapper (or a system Gradle) whose version is below the value in the /minimumGradleVersion resource. For example, if minimumGradleVersion is '8.10' and the runner uses Gradle 8.5.

Common situations: A developer uses a system-installed Gradle (gradle build) instead of the wrapper (./gradlew build), and the system Gradle is outdated. The gradle-wrapper.properties was updated to a newer Gradle version but the developer's Gradle SDK in IntelliJ is still pointed at an old version. A CI image has an outdated Gradle that shadows the wrapper.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/7fb2145f0f65372d. Report an issue: GitHub.