diff --git a/build.gradle b/build.gradle index c843069f43e..bf4b5a3b415 100644 --- a/build.gradle +++ b/build.gradle @@ -144,6 +144,14 @@ subprojects { // see https://discuss.gradle.org/t/add-custom-javadoc-option-that-does-not-take-an-argument/5959 javadoc.options.encoding='UTF8' javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet') + /* + TODO: building javadocs with java 9 b118 is currently broken with weird errors, so + for now this is commented out...try again with the next ea build... + javadoc.executable = new File(project.javaHome, 'bin/javadoc') + if (project.javaVersion == JavaVersion.VERSION_1_9) { + // TODO: remove this hack! gradle should be passing this... + javadoc.options.addStringOption('source', '8') + }*/ } } diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 455f16d123a..168ceca1d23 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -143,7 +143,7 @@ class BuildPlugin implements Plugin { } project.rootProject.ext.javaHome = javaHome - project.rootProject.ext.javaVersion = javaVersion + project.rootProject.ext.javaVersion = javaVersionEnum project.rootProject.ext.buildChecksDone = true } project.targetCompatibility = minimumJava @@ -387,10 +387,13 @@ class BuildPlugin implements Plugin { options.encoding = 'UTF-8' //options.incremental = true - // gradle ignores target/source compatibility when it is "unnecessary", but since to compile with - // java 9, gradle is running in java 8, it incorrectly thinks it is unnecessary - assert minimumJava == JavaVersion.VERSION_1_8 - options.compilerArgs << '-target' << '1.8' << '-source' << '1.8' + if (project.javaVersion == JavaVersion.VERSION_1_9) { + // hack until gradle supports java 9's new "-release" arg + assert minimumJava == JavaVersion.VERSION_1_8 + options.compilerArgs << '-release' << '8' + project.sourceCompatibility = null + project.targetCompatibility = null + } } } }