java - Gradle does not honor --add-modules jvm argument in JDK9 -


i trying jdk9 (9-ea+143), , need set --add-modules java.xml.bind. have tried:

  • setting gradle_opts="--add-modules java.xml.bind '-dorg.gradle.jvmargs=--add-modules java.xml.bind'"
  • setting org.gradle.jvmargs=--add-modules java.xml.bind in gradle.properties.
  • adding test { jvmargs '--add-modules java.xml.bind' } build.gradle
  • adding tasks.withtype(test) { jvmargs '--add-modules java.xml.bind' } build.gradle
  • adding tasks.withtype(javaexec) { jvmargs '--add-modules java.xml.bind' } build.gradle

tests still fail. missing?

i have example project in https://github.com/henrik242/gradle-jdk9-test-problem

✨  ./gradlew build :compilejava /foo/gradle-jdk9-test-problem/src/main/java/someclass.java:1: error: package javax.xml.bind not exist import javax.xml.bind.validationexception;                      ^ /foo/gradle-jdk9-test-problem/src/main/java/someclass.java:5: error: cannot find symbol   public void dostuff() throws validationexception {                                ^   symbol:   class validationexception   location: class someclass /foo/gradle-jdk9-test-problem/src/main/java/someclass.java:6: error: cannot find symbol     throw new validationexception("msg");               ^   symbol:   class validationexception   location: class someclass 3 errors :compilejava failed 

it works when adding following build.gradle:

compilejava {   options.compilerargs += ["--add-modules", "java.xml.bind"] }  compiletestjava {   options.compilerargs += ["--add-modules", "java.xml.bind"] }  test {   jvmargs += ["--add-modules", "java.xml.bind"] } 

is there easier way?

edit: works:

tasks.withtype(abstractcompile) {   options.compilerargs += ["--add-modules", "java.xml.bind"] }  tasks.withtype(test) {   jvmargs += ["--add-modules", "java.xml.bind"] } 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -