diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index ed51978967a42..ec49c6834f18f 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -27,11 +27,6 @@ plugins { group = 'org.elasticsearch.gradle' -String minimumGradleVersion = file('src/main/resources/minimumGradleVersion').text.trim() -if (GradleVersion.current() < GradleVersion.version(minimumGradleVersion)) { - throw new GradleException("Gradle ${minimumGradleVersion}+ is required to build elasticsearch") -} - if (project == rootProject) { // change the build dir used during build init, so that doing a clean // won't wipe out the buildscript jar diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 7c09e81643efc..b91a3b6d9919a 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -66,18 +66,6 @@ class BuildPlugin implements Plugin { + 'elasticsearch.standalone-rest-test, and elasticsearch.build ' + 'are mutually exclusive') } - String minimumGradleVersion = null - InputStream is = getClass().getResourceAsStream("/minimumGradleVersion") - try { - minimumGradleVersion = IOUtils.toString(is, StandardCharsets.UTF_8.toString()) - } finally { - is.close() - } - if (GradleVersion.current() < GradleVersion.version(minimumGradleVersion.trim())) { - throw new GradleException( - "Gradle ${minimumGradleVersion}+ is required to use elasticsearch.build plugin" - ) - } project.pluginManager.apply('elasticsearch.java') configureLicenseAndNotice(project) project.pluginManager.apply('elasticsearch.publish') diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java index f1e04da2d2f09..16b72372b7ef5 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/info/GlobalBuildInfoPlugin.java @@ -66,6 +66,10 @@ public void apply(Project project) { if (project != project.getRootProject()) { throw new IllegalStateException(this.getClass().getName() + " can only be applied to the root project."); } + GradleVersion minimumGradleVersion = GradleVersion.version(Util.getResourceContents("/minimumGradleVersion")); + if (GradleVersion.current().compareTo(minimumGradleVersion) < 0) { + throw new GradleException("Gradle " + minimumGradleVersion.getVersion() + "+ is required"); + } JavaVersion minimumCompilerVersion = JavaVersion.toVersion(Util.getResourceContents("/minimumCompilerVersion")); JavaVersion minimumRuntimeVersion = JavaVersion.toVersion(Util.getResourceContents("/minimumRuntimeVersion"));