Jar tool to transform a plain old JAR file to a modular JAR

Mandy Chung mandy.chung at oracle.com
Mon Apr 11 10:30:12 PDT 2011


  On 04/11/11 04:40, Alan Bateman wrote:
> Mandy Chung wrote:
>>
>>
>> This week I pushed the changeset to support modular JAR Files [1].
>> Below is a proposal to enhance the jar command-line tool to transform
>> a plain old JAR file into a modular JAR file by adding module metadata
>> to ease migration.  It's also posted at:
>>    http://cr.openjdk.java.net/~mchung/jigsaw/modular-jar-files.txt
> The proposal mostly looks good to me.
>
> One comment on the options is that I don't think the jar command has 
> any GNU-style options yet, it only has the traditional single letter 
> options. No issue moving to the new style but it makes me wonder if we 
> should introduce GNU-styles for the existing options.

That's what I'm thinking too and thus use the GNU-style long-named 
option in the proposal.  It should be time to introduce the GNU-style 
command-line options to some of our tools and I think it should be a 
proposed JDK technical feature separating from this.

>
> I'm in two minds as to if we need --requires-module as it gets to the 
> point where it's just as easy to create and compile the module-info 
> yourself. Initially it might be fine to just support --module to 
> create the most basic of module-info files. 

I think so.

Once we have the initial prototype, we will know better when we get the 
feedback and experience of transforming existing jar files to modular jars.

> If jar is generating the module-info then I agree we need an option to 
> save it somewhere but "--module-info=java={dir}" gives the impression 
> that it reads {dir}/module-info.java. Maybe needs to be something like 
> --save-module-info or --output-module-info?
>

How about --save-module-info-source={dir}?  It's a source file and 
thought that it might be better to make it clear.

> On the signed JAR issue then maybe jar should emit a warning when it 
> updates a signed JAR and that would cover the adding module-info case 
> too.
>

We should also update jarsigner -verify option to detect and emit the 
appropriate information.  I'll include these notes.

Thanks
Mandy




More information about the jigsaw-dev mailing list