RFR: jpkg contents/show commands
Chris Hegarty
chris.hegarty at oracle.com
Mon May 21 08:45:37 PDT 2012
On 21/05/2012 16:30, Paul Sandoz wrote:
> ....
>
>>> A useful addition, not suggesting for this patch, is the ability to
>>> extract out jar/class files from a jmod package or a module installed
>>> into a library.
>>
>> 'jmod extract <module-file>' will extract the contents of a module
>> file to the file system. Is this what you are looking for?
>
> Yes, will it always extract to a zip of classes or reuse the same
> compression in the module e.g. pack200?
The current implementation extracts to a zip classes archive.
>> Or maybe you're asking about something like an export facility from
>> the module library?
>>
>
> This too.
>
> The use-case is for tools and IDEs that need to scan class files i.e. a
> simple, not very efficient solution, until there are proper APIs in
> place to help scan for classes in jmod packages and and libraries.
>
>
>>>> If these new commands are to stay in jpkg long term we should
>>>> probably change the command that builds the jmod/deb files to
>>>> create/build, so 'jpkg create ... jmod'.
>>>>
>>>
>>> Yes.
>>>
>>> What about for modular jar files?
>>
>> That's next on my list ;-) I really like the idea of a 'create'
>> command that can take an argument to determine what type of package to
>> create,
>> jpkg create ... [jmod|deb|jar|ips|...]
>>
>
> Me too. Does it makes sense for the "jar" command to be reused for
> creating a modular jar? (perhaps in addition to that of jpkg for
> consistency).
Thanks to Mandy we already have support for modular jars in the jar
command :-) I think we just need to add it to jpkg for consistency, as
you said.
:> bin/jar
Usage: jar {ctxui}[vfm0MeI] [jar-file] [manifest-file] [entry-point]
[module-id] [-C dir] files ...
Options:
-c create new archive
-t list table of contents for archive
-x extract named (or all) files from archive
-u update existing archive
-v generate verbose output on standard output
-f specify archive file name
-m include manifest information from specified manifest file
-e specify application entry point for stand-alone application
bundled into an executable jar file
-0 store only; use no ZIP compression
-M do not create a manifest file for the entries
-i generate index information for the specified jar files
-C change to the specified directory and include the following file
-I specify the module id for this modular JAR.
It must match the id declared in module-info.class if exists.
If any file is a directory then it is processed recursively.
The manifest file name, the archive file name and the entry point name are
specified in the same order as the 'm', 'f' and 'e' flags.
Example 1: to archive two class files into an archive called classes.jar:
jar cvf classes.jar Foo.class Bar.class
Example 2: use an existing manifest file 'mymanifest' and archive all the
files in the foo/ directory into 'classes.jar':
jar cvfm classes.jar mymanifest -C foo/ .
Example 3: update an existing jar to a modular JAR
jar uvfI classes.jar acme.foo at 1.0
or
jar uvf classes.jar module-info.class
-Chris.
>
> Paul.
More information about the jigsaw-dev
mailing list