Reputation: 1089
The dependency jar added to the assembly zip has "SNAPSHOT
" version added to its name. Is there a way to get only version
number from ${artifact.baseVersion}
without SNAPSHOT
?
This is run inside maven-assembly-plugin
. I would like the dependency to output like parent-2.0.jar
instead of parent-2.0-SNAPSHOT.jar
.
assembly.xml
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>www.example.com:parent:jar:2.0-SNAPSHOT</include>
</includes>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
</dependencySets>
Upvotes: 1
Views: 2287
Reputation: 1089
I cannot find a simple solution. So I have added new property ${client-version}
and used it in assmebly.xml.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<client-version>2.0</client-version>
</properties>
assembly.xml
<outputFileNameMapping>${artifact.artifactId}-${client-version}.${artifact.extension}</outputFileNameMapping>
Upvotes: 0
Reputation: 11411
There's a few methods of doing this depending on your pipeline. The maven versions plugin can be used,
http://www.mojohaus.org/versions-maven-plugin/set-mojo.html
http://www.mojohaus.org/versions-maven-plugin/set-mojo.html#removeSnapshot
A configuration like this would do it,
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.4</version>
<configuration>
<newVersion>${project.version}</newVersion>
<allowSnapshots>false</allowSnapshots>
</configuration>
</plugin>
I'd recommend wrapping it in a profile
and activate it only when required. This will update the project.version
with in the POM. You can then commit it back to the repo, leave it as is etc. etc.
You may also want to look at the build helper plugin which can handle regex-ing properties etc. if the versions plugin doesn't meet your needs.
http://www.mojohaus.org/build-helper-maven-plugin/usage.html#
Upvotes: 1