Discover modulename

Robert Scholte rfscholte at apache.org
Thu Aug 25 17:28:00 UTC 2016


Hi,

JavaOne spoiler alert:
I've been able to add this kind of information to the output of the  
maven-dependency-plugin:

[INFO] --- maven-dependency-plugin:3.0.0-SNAPSHOT:list (default-cli) @  
maven-dependency-plugin ---
[INFO]
[INFO] The following files have been resolved:
[INFO]    com.google.code.findbugs:jsr305:jar:2.0.1:compile -- module  
jsr305
[INFO]    org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6:compile  
-- module wagon.provider.api
[INFO]    org.apache.maven:maven-compat:jar:3.0:test -- module maven.compat
[INFO]    org.apache.maven.doxia:doxia-decoration-model:jar:1.4:compile --  
module doxia.decoration.model
[INFO]    org.apache.maven:maven-settings-builder:jar:3.0:compile --  
module maven.settings.builder
[INFO]    org.sonatype.aether:aether-util:jar:1.7:compile -- module  
aether.util
[INFO]    org.apache.maven:maven-core:jar:3.0:compile -- module maven.core
etc.

this way users have a relative simple way to get a complete overview of  
all the modules used.
I might tweak the output, but the info is there.

Robert

On Thu, 25 Aug 2016 12:26:48 +0200, Robert Scholte <rfscholte at apache.org>  
wrote:

> Hi,
>
> In an old thread I asked this before and got the following answer:
> "One way is `jar --file foo.jar -p`. That will print the module  
> descriptor when the JAR file is a modular JAR. There is API support for  
> reading the binary form of the module declaration too."
>
> With the renaming of the arguments I assume it is now:
> jar --file foo.jar --print-module-descriptor
>
> However, this gives me an exception on the asm-6.0_ALPHA.jar
>
> d:\jdk-9\bin\jar --file asm-6.0_ALPHA.jar --print-module-descriptor
> java.lang.module.InvalidModuleDescriptorException: Index into constant  
> pool out of range
>          at  
> java.lang.module.ModuleInfo.invalidModuleDescriptor(java.base at 9-ea/ModuleInfo.java:804)
>
>
> How about jars without module descriptor? Is there a commandline option  
> to discover what the name of an automodule will be? I could guess the  
> name, but I'd prefer to show the calculated name.
>
> thanks,
> Robert


More information about the jigsaw-dev mailing list