Elasticsearch with OpenJDK9

I m trying to build Elasticsearch with OpenJDK9. Initially I got following error:

-bash-4.2$ gradle assemble
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)

After setting 'JDK_JAVA_OPTIONS' I was able to proceed further:

export JDK_JAVA_OPTIONS='--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED'

However now I am getting following error:

:buildSrc:writeVersionProperties FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/.../buildSrc/build.gradle' line: 61
* What went wrong:
Execution failed for task ':buildSrc:writeVersionProperties'.
> No signature of method: static java.nio.file.Files.newOutputStream() is applicable for argument types: (sun.nio.fs.UnixPath) values: [/localbox/Benchmarking/elasticsearch/buildSrc/build-bootstrap/version.properties]

My build environment looks like:
Elasticsearch version: 5.4.0
Java: 9-internal
Gradle: 3.3
OS: RHEL7.3 Linux 3.10.0-514.16.1.el7.x86_64 amd64

Any pointers/help is appreciated.

You can see all the read edges we add in our CI job output for the jdk 9 job:
https://elasticsearch-ci.elastic.co/view/Elasticsearch/job/elastic+elasticsearch+master+java9-periodic/3027/consoleFull

Specifically:

export 'GRADLE_OPTS=--add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED'

Also note that due to gradle not quite working with java 9 yet, we run gradle with java 8 by setting org.gradle.java.home to a jdk8 installation in our ~/gradle.properties, and then hava JAVA_HOME set to the jdk9 installation we are testing. The add opens are needed for gradle still because setting org.gradle.java.home is only respected after gradle first does a minimal initialization on the java found from JAVA_HOME.

Thanks for your reply.

I am able to build Elasticsearch with Gradle and OpenJDK9 after exporting JDK_JAVA_OPTIONS='--permit-illegal-access' in the environment. I did encountered issue with Javadoc (Referred here: https://github.com/elastic/elasticsearch/issues/24733) due to which I have temporarily disabled javadoc in build.gradle file.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.