eeijlar
eeijlar

Reputation: 1342

How do I prevent maven from appending the version number to the built jar?

I am trying to exclude the version number from the jar that maven builds. So, atf-1.0.jar will simply become atf.jar. However, the snippet below always appends the version number to the jar name. I have tried using destinationFileName but it doesn't seem to make any difference. I can't see which part of the pom.xml is actually appending the version. I am using this snippet from pom.xml. This phase copies the built jars to the output directory.

       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.8</version>
            <executions>
                <execution>
                    <id>copy-built-resources</id>
                    <phase>install</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <type>${project.packaging}</type>
                            </artifactItem>
                        </artifactItems>
                        <destinationFileName>atf.jar</destinationFileName>
                        <outputDirectory>${utf.release.dir}</outputDirectory>
                    </configuration>
                </execution>

Any ideas greatly appreciated...

Upvotes: 1

Views: 2343

Answers (1)

khmarbaise
khmarbaise

Reputation: 97409

You have to use the <stripVersion>true</stripVersion> option to achieve what you like to do.

Upvotes: 3

Related Questions