I am trying to compile my java project with Java 9. I am using the java.xml.bind package so I need to use the -addmods option for compiling. Ant 1.9.7 does not seem to support this new feature. Does ant support -addmods option for Java 9 compiler?
There is no explicit support in any released version of Ant at this point in time. But you should be able to use <jvmarg>
for that
<java ....>
<jvmarg value="--add-modules"/>
<jvmarg value="module.name.to.add"/>
<jvmarg ..../>
</java>
If you are asking about <javac>
rather than <java>
, <compilerarg>
can be used instead.
There are quite a few ways that Java 9 manages to break Ant - and 1.9.8 and 1.10.x will contain a lot of fixes for it (there will be new releases soon once the last known issues have been ironed out). Right now there is no explicit support for --add-modules
, though, only for modulepath
and upgrademodulepath
which have been added in Ant 1.9.7.
IMHO - Would be a good enhancement request though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With