From faf5f55f41447d6c244485594f0eb98b16da831c Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 6 Nov 2015 11:38:25 -0500 Subject: [PATCH 1/2] Enforce Java 8 in Gradle builds This commit forces builds with Gradle to require at least Java 8. Closes #14499 --- .../main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index fb1e9ec9722..3cf912d0fd3 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -59,6 +59,11 @@ class BuildPlugin implements Plugin { throw new GradleException('Gradle 2.6 or above is required to build elasticsearch') } + // enforce Java version + if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_8) < 0) { + throw new GradleException('Java 8 or above is required to build Elasticsearch') + } + // Build debugging info println '=======================================' println 'Elasticsearch Build Hamster says Hello!' From b0c70650007221e7465ba8207d71100e9e9637a3 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 6 Nov 2015 12:28:31 -0500 Subject: [PATCH 2/2] Cleaner version check --- .../src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 3cf912d0fd3..65b6fcc4974 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -60,7 +60,7 @@ class BuildPlugin implements Plugin { } // enforce Java version - if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_8) < 0) { + if (!JavaVersion.current().isJava8Compatible()) { throw new GradleException('Java 8 or above is required to build Elasticsearch') }