Java 9 and later added several new options to the jar tool. I would like to use the --module-version option with Ant's Jar task, but I could not find that option in the manual. I can accomplish this using exec, but it would be simpler if that option worked with the jar task.
I did a very small test: - created a simple module-info.java module com.greetings { } - compiled with JDK 10.0.1 (Win7-64bit) javac . - created a module jar with JDK 10 jar.exe --create --file foo.jar --main-class=com.foo.Main --module-version=1.0 . - compared the JAR with the parameters and the original sources What I could see is, that 1) the paramater --module-version is placed in the compiled module-info.class file 2) the parameter --main-class is placed in the manifest AND in the compiled module-info.class Adding the value to the generated manifest should be trivial, but changing the compiled file ... needs discussion. ;-)
FWIW, the --hash-modules option (and some others) of the jar command to plays a role according to[1] in the generated jar file. More specifically, the "Packaging: Modular JAR files" section of [1] has details of these options. [1] http://openjdk.java.net/jeps/261