Maven-publish to S3 is broken for Java 11


When using Gradle 4.8 to publish to S3, using the early access builds of Java 11, we get this:

Caused by: org.gradle.api.GradleException: Cannot publish to S3 since the module 'java.xml.bind' is not available. Please add "-addmods java.xml.bind '-Dorg.gradle.jvmargs=-addmods java.xml.bind'" to your GRADLE_OPTS.

However, java.xml.bind is no longer included in the JDK, so that recommendation is not correct, we can’t -addmods, as adding it causes the JVM to not start anymore.

I found this solution:

But since this is not an actual build issue, I don’t know where to put the dependencies. The Maven-publish plugin seems to be built-in to Maven, I guess it needs these dependencies added.

Where do I put them?

We’re gonna upgrade the AWS SDK for Gradle 5.0, which will hopefully get rid of the java.xml.bind dependency.

I’m experiencing this same issue with the release versions of Gradle 4.10.2 and Java 10.0.2. Is there a work around for this issue until Gradle 5 is released?

The work around found for Gradle 4.10.2 and Java 10.0.2 was to put the following on line 2 of my gradlew:

GRADLE_OPTS="--add-modules java.xml.bind '-Dorg.gradle.jvmargs=--add-modules java.xml.bind'"

But with the production release of 11.0.0 (OpenJDK) released this week, this work around no longer works. Does anyone know one that will?

1 Like