You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chris Graham <ch...@warpspeed.com.au> on 2008/12/13 10:30:55 UTC

Renaming jars using the assembly plugin

Hi All.

I am attempting to build a zip file of all listed dependencies of a project.

I am sucessfully creating the zip file with all deps included in it.
However, I need to strip the version numbers from the jar files.

This is the assembly file, it is packaged as a jar file.

<?xml version='1.0' encoding='UTF-8'?>
<assembly>
    <id></id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory></outputDirectory>
            <outputFileNameMapping></outputFileNameMapping>
            <unpack>true</unpack>
            <unpackOptions>
                <includes>
                    <include>*.jar</include>
                </includes>
            </unpackOptions>
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
</assembly>

It is used as such:

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>zip-for-wid</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attached</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>au.com.warpspeed.maven.assemblies</groupId>
                        <artifactId>zip-for-wid</artifactId>
                        <version>0.0.1-SNAPSHOT</version>
                    </dependency>
                </dependencies>
            </plugin>

I've tried using the outputFileNameMapping entry, but it does not work.

Help!

This is driving me nuts!

-Chris

-- 
View this message in context: http://www.nabble.com/Renaming-jars-using-the-assembly-plugin-tp20988586p20988586.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Renaming jars using the assembly plugin

Posted by Chris Graham <ch...@warpspeed.com.au>.
It appears that when you unpack things, then you can not change their names.
And for whatever reasons, what I had was overly complex.

This works:

<?xml version='1.0' encoding='UTF-8'?>
<assembly>
    <id></id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory></outputDirectory>
           
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
            <includes>
                <include>*:jar</include>
            </includes>
        </dependencySet>
    </dependencySets>
</assembly>

-Chris


Chris Graham wrote:
> 
> Hi All.
> 
> I am attempting to build a zip file of all listed dependencies of a
> project.
> 
> I am sucessfully creating the zip file with all deps included in it.
> However, I need to strip the version numbers from the jar files.
> 
> This is the assembly file, it is packaged as a jar file.
> 
> <?xml version='1.0' encoding='UTF-8'?>
> <assembly>
>     <id></id>
>     <formats>
>         <format>zip</format>
>     </formats>
>     <includeBaseDirectory>false</includeBaseDirectory>
>     <dependencySets>
>         <dependencySet>
>             <outputDirectory></outputDirectory>
>             <outputFileNameMapping></outputFileNameMapping>
>             <unpack>true</unpack>
>             <unpackOptions>
>                 <includes>
>                     <include>*.jar</include>
>                 </includes>
>             </unpackOptions>
>             <scope>runtime</scope>
>         </dependencySet>
>     </dependencySets>
> </assembly>
> 
> It is used as such:
> 
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-assembly-plugin</artifactId>
>                 <configuration>
>                     <descriptorRefs>
>                         <descriptorRef>zip-for-wid</descriptorRef>
>                     </descriptorRefs>
>                 </configuration>
>                 <executions>
>                     <execution>
>                         <id>make-assembly</id>
>                         <phase>package</phase>
>                         <goals>
>                             <goal>attached</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>                 <dependencies>
>                     <dependency>
>                        
> <groupId>au.com.warpspeed.maven.assemblies</groupId>
>                         <artifactId>zip-for-wid</artifactId>
>                         <version>0.0.1-SNAPSHOT</version>
>                     </dependency>
>                 </dependencies>
>             </plugin>
> 
> I've tried using the outputFileNameMapping entry, but it does not work.
> 
> Help!
> 
> This is driving me nuts!
> 
> -Chris
> 
> 

-- 
View this message in context: http://www.nabble.com/Renaming-jars-using-the-assembly-plugin-tp20988586p20988731.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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