You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by KC Baltz <KC...@Copart.Com> on 2005/11/01 00:43:44 UTC

Inconsistency between JAR and Assembly

I'm trying to package my application with its dependencies such that the main jar file is executable.  That means have a Class Path entry in the Manifest of the main jar.  I can get this to work with the following in my pom.xml:
 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                    <manifest>
                      <mainClass>com.copart.handheld.Main</mainClass>
                      <packageName>com.copart.handheld</packageName>
                      <addClasspath>true</addClasspath>
                    </manifest>
                  </archive>
                </configuration>
            </plugin> 

That puts entries into the Manifest like the following:
 
Class-Path: someJar-1.0-SNAPSHOT.jar anotherJar-1.0-SNAPSHOT.jar yetA
 notherJar-1.0-SNAPSHOT.jar
 
This is what I want. 
 
However, when I use the Assembly plugin to create a ZIP file and instruct it to include the dependent jars, I can't get it to name them like the above.  I'm using the following tag:
 
      <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>

That produces jars like:
    someJar.jar
    anotherJar.jar
    yetAnotherJar.jar
 
If I use:
 
      <outputFileNameMapping>${artifactId}-${version}.${extension}</outputFileNameMapping>
 
I get:
 
    someJar-1.0-20051031.184027-1.jar
    anotherJar-1.0-20051031.182639-1.jar
    yetAnotherJar-1.0-20051031.183047-1.jar
 
Is there any way to produce jars with the -1.0-SNAPSHOT  version number?  
 
K.C.
 

 
 
 

Re: Inconsistency between JAR and Assembly

Posted by Barrie Treloar <ba...@gmail.com>.
> > I'm trying to package my application with its dependencies such that the
> > main jar file is executable.  That means have a Class Path entry in the
> > Manifest of the main jar.  I can get this to work with the following in my
> > pom.xml:
> >
> >             <plugin>
> >                 <groupId>org.apache.maven.plugins</groupId>
> >                 <artifactId>maven-jar-plugin</artifactId>
> >                 <configuration>
> >                     <archive>
> >                     <manifest>
> >                       <mainClass>com.copart.handheld.Main</mainClass>
> >                       <packageName>com.copart.handheld</packageName>
> >                       <addClasspath>true</addClasspath>
> >                     </manifest>
> >                   </archive>
> >                 </configuration>
> >             </plugin>
> >
> > That puts entries into the Manifest like the following:
> >
> > Class-Path: someJar-1.0-SNAPSHOT.jar anotherJar-1.0-SNAPSHOT.jar yetA
> >  notherJar-1.0-SNAPSHOT.jar
> >
> > This is what I want.
> >
> > However, when I use the Assembly plugin to create a ZIP file and instruct
> > it to include the dependent jars, I can't get it to name them like the
> > above.  I'm using the following tag:
> >
> >
> > <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
> >
> > That produces jars like:
> >     someJar.jar
> >     anotherJar.jar
> >     yetAnotherJar.jar

See http://jira.codehaus.org/browse/MASSEMBLY-67

>From the notes:

The solution here is to use an outputFileNameMapping such as this:

${artifactId}-${baseVersion}.${extension}

Using ${baseVersion} for cases where you want to preserve the
-SNAPSHOT naming, the plugin retains the ability to use ${version} for
the timestamp-buildnumber naming, which is useful for describing the
exact library version included in the assembly.

I've added an integration test:
/basic-features/outputFileNameMapping-withArtifactBaseVersion to
verify that this is fixed.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Inconsistency between JAR and Assembly

Posted by Peter <we...@gmx.ch>.
Hi K.C.,

I'm new to Maven (two weeks now ...) However, I get a version number that
looks like someJar-1.0-SNAPSHOT.jar. The version number you get, looks like
a version number after deploying a snapshot. 

Therefore, I suggest you check the following things:
1. did you run the assembly from the working copy directory?
2. what are the versions within the directory you did run the assembly? 
3. verify your POM.xml, does it have the a snapshot version?

Sorry, that I can't help you more, i droped in because I had another problem
with assembly :-)

Cheers
Peter

I get the 

KC Baltz wrote:
> 
> I'm trying to package my application with its dependencies such that the
> main jar file is executable.  That means have a Class Path entry in the
> Manifest of the main jar.  I can get this to work with the following in my
> pom.xml:
>  
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-jar-plugin</artifactId>
>                 <configuration>
>                     <archive>
>                     <manifest>
>                       <mainClass>com.copart.handheld.Main</mainClass>
>                       <packageName>com.copart.handheld</packageName>
>                       <addClasspath>true</addClasspath>
>                     </manifest>
>                   </archive>
>                 </configuration>
>             </plugin> 
> 
> That puts entries into the Manifest like the following:
>  
> Class-Path: someJar-1.0-SNAPSHOT.jar anotherJar-1.0-SNAPSHOT.jar yetA
>  notherJar-1.0-SNAPSHOT.jar
>  
> This is what I want. 
>  
> However, when I use the Assembly plugin to create a ZIP file and instruct
> it to include the dependent jars, I can't get it to name them like the
> above.  I'm using the following tag:
>  
>      
> <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
> 
> That produces jars like:
>     someJar.jar
>     anotherJar.jar
>     yetAnotherJar.jar
>  
> If I use:
>  
>      
> <outputFileNameMapping>${artifactId}-${version}.${extension}</outputFileNameMapping>
>  
> I get:
>  
>     someJar-1.0-20051031.184027-1.jar
>     anotherJar-1.0-20051031.182639-1.jar
>     yetAnotherJar-1.0-20051031.183047-1.jar
>  
> Is there any way to produce jars with the -1.0-SNAPSHOT  version number?  
>  
> K.C.
>  
> 
>  
>  
>  
> 
> 

-- 
View this message in context: http://www.nabble.com/Inconsistency-between-JAR-and-Assembly-tf473891.html#a5785059
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org