Re: Is there a maven plugin for storing the dependency information in the jar?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a maven plugin for storing the dependency information in the jar?

Owen O'Malley
On Tue, Jun 20, 2017 at 1:49 PM, Jörg Schaible <[hidden email]>
wrote:

>
> dependency:list has an outputFile configuration entry and if the goal is
> called in the generate ressources phase and the file is written to
> target/generated-ressources it will be picked up for the jar file.


Ok, that would work. Playing more with it, it also looks like configuring
the maven-jar-plugin with:

        <configuration>
          <archive>
            <index>true</index>
            <manifest>
              <addClasspath>true</addClasspath>
            </manifest>
          </archive>
        </configuration>

will work as a first pass. It will add the list of jars to the
META-INF/MANIFEST.MF and build the list of directories in each of those
jars in META-INF/INDEX.LIST.

The Class-Path entry in MANIFEST.MF looks like:

Class-Path: com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.
 0.jar commons-lang/commons-lang/2.6/commons-lang-2.6.jar io/airlift/a
 ircompressor/0.3/aircompressor-0.3.jar org/apache/hadoop/hadoop-commo
 n/2.6.4/hadoop-common-2.6.4.jar org/apache/hadoop/hadoop-annotations/
 ...


The INDEX.LIST looks like:

JarIndex-Version: 1.0

orc-core-1.5.0-SNAPSHOT.jar
META-INF
META-INF/maven
META-INF/maven/org.apache.orc
META-INF/maven/org.apache.orc/orc-core
org
org/apache
org/apache/orc
org/apache/orc/impl
org/apache/orc/impl/writer
org/apache/orc/util

com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar
META-INF/maven
META-INF/maven/com.google.protobuf
META-INF/maven/com.google.protobuf/protobuf-java
com
com/google
com/google/protobuf

So the INDEX.LIST provides what I need and provides the list of packages in
each jar as well. (Although it is annoying that the root jar entry doesn't
have the groupId and as a directory name.)

Thanks,
   Owen
Loading...