There is currently no explicit support for any released version of Ant. But you should be able to use <jvmarg> for this.
<java ....> <jvmarg value="--add-modules"/> <jvmarg value="module.name.to.add"/> <jvmarg ..../> </java>
If you are asking about <javac> and not <java> , you can use <compilerarg> instead.
There are several ways in which Java 9 manages to break Ant - and 1.9.8 and 1.10.x will contain many fixes for it (new releases will be released soon after the latest known issues are discovered outside). Right now, there is no explicit support for --add-modules , though, only for modulepath and upgrademodulepath , which were added in Ant 1.9.7.
IMHO - there will be a good request for improvement.
source share