Maven SNAPSHOT jar file names not consistent using Maven Assembly in MANIFEST file
In <dependencySet>
you need to set <outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension}</outputFileNameMapping>
for example:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>appserverB</id>
<formats>
<format>zip</format>
</formats>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>application:logging</include>
<include>application:core</include>
<include>application:utils</include>
<include>application:appserverB</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>
If you are using one of the built-in assembly descriptors you will need to replicate it for your self and add in the outputFileNameMapping
entry yourself
For people who use maven-jar-plugin
to create the artifact which is then packed by the maven-assembly-plugin
and you still see timestamps in the classpath in artifact names, you can disable that by setting useUniqueVersions=false
, as follows:
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>${project.build.finalName}.lib/</classpathPrefix>
<mainClass>com.nafora.nate.Application</mainClass>
<!-- To force the use of '-SNAPSHOT' version naming, simply disable the <useUniqueVersions> -->
<useUniqueVersions>false</useUniqueVersions>
</manifest>
<manifestEntries>
<buildTime>${maven.timestamp}</buildTime>
</manifestEntries>
</archive>
</configuration>
</plugin>