Bug 62789 - Update JAR Task to Specify --module-version Parameter
Summary: Update JAR Task to Specify --module-version Parameter
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.10.1
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2018-10-02 05:42 UTC by Bruce Alspaugh
Modified: 2018-10-03 08:18 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Bruce Alspaugh 2018-10-02 05:42:34 UTC
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.
Comment 1 Jan Mat 2018-10-02 10:35:00 UTC
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
    --file foo.jar  
- 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. ;-)
Comment 2 Jaikiran Pai 2018-10-03 08:18:37 UTC
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