How do I pass Java command line options to Coursier when the Java option is two words?

196 Views Asked by At

I need to pass the command line option, --add-exports, to java. Example:

--add-exports java.management/sun.management=ALL-UNNAMED

If I try to use the --java-opt for Coursier, it does not work and I get an error. It appears Coursier is not parsing the two word argument needed for --add-exports.

cs launch --java-opt --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED com.google.googlejavaformat:google-java-format:1.13.0 -- src/main/java/com/example/demo/DemoApplication.java

The error for the above example is

Cannot find app jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED in channels io.get-coursier:apps

What is the correct command line syntax for Couriser to pass the Java '--add-exports' option?

Found solution by using the Coursier -J syntax as documented here.

-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED

0

There are 0 best solutions below