Question

I am using Maven 2.2.1 and JDK 1.7.0_51 and I am re-packaging some jar files into a single jar.

I have a problem where the maven-assembly-plugin is adding -generic to the name of my jar that I am creating. The output is xxxxLib-4.2.11-generic.jar, i want it to be xxxxLib-4.2.11.jar

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xxxx</groupId>
<artifactId>xxxx-assembly</artifactId>
<version>4.2.11</version>
<name>xxxxLib</name>
<build>
    <finalName>${project.name}-${project.version}</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <skipIfEmpty>true</skipIfEmpty>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptors>
                    <descriptor>src/assembly/descriptor.xml</descriptor>
                </descriptors>
                <finalName>${project.name}-${project.version}</finalName>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin> ....

The assembly descriptor is as follows:

<assembly>
    <id>generic</id>
    <formats>
        <format>jar</format>
    </formats>
    <baseDirectory>maven</baseDirectory>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>${project.build.directory}/lib</directory>
            <outputDirectory></outputDirectory>
        </fileSet>
    </fileSets>
</assembly>
Était-ce utile?

La solution

I have found a solution to this problem, I have added the code below above the descriptors tag and this has now stopped the generic tag being added to the jar as I want.

    <appendAssemblyId>false</appendAssemblyId>
    <finalName>${project.name}-${project.version}</finalName>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top