Using OpenJDK Early Access builds and Gradle


(Jeremy Whiting) #1

Hi,
I am testing to check for any nasty surprises with up and coming JDKs. I downloaded an early access build from OpenJDK.

When I attempt to use JDK11 I get this error reported by Gradle.

$ grep distributionUrl gradle/wrapper/gradle-wrapper.properties
distributionUrl=gradle-4.6-bin.zip
$ /usr/lib/jvm/openjdk-11-ea/bin/java -version
openjdk version “11-ea” 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11-ea+11)
OpenJDK 64-Bit Server VM 18.9 (build 11-ea+11, mixed mode)
$ ./gradlew --stacktrace

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine java version from ‘11-ea’.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org
    $

It appears the version string cannot be parsed. Am I unrealistic in attempting to use an OpenJDK Early Access build?

Regards,
Jeremy


(uklance) #2

As a workaround, you can try passing -Djava.version=10 on command line. See JavaVersion.java


(Stefan Oehme) #3

You’ll need to use a newer Gradle version, 4.6 is too old. Try 4.8-rc-2 or the 4.9 nightlies.


(Jeremy Whiting) #4

$ ./gradlew -Djava.version=10

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not create service of type DaemonContext using DaemonServices.createDaemonContext().
    Thanks for the suggestion.

(Jeremy Whiting) #5

I’ll give this a try.