The simplest and "manual" way
The simplest practice for getting an artifact with the VCS revision of the file name is put the desired revision in the version set to pom.xml
. Although it is a "manual" procedure, this helps to maintain some consistency.
Versions Maven Plugin can help with this task a little.
Using the releases plugin
There is also the Maven Release Plugin that could be useful depending on how your process. It is able to create a tag in SVN and update the version of the poms.
Changing the "final" name of the artifact in Maven
In Maven, you can set the <finalName>
tag to its pom.xml
so that after the build the final artifact has the name you want. See documentation here .
By default, maven adds the pom version as follows:
<finalName>${artifactId}-${version}</finalName>
Then you could define some other property, for example:
<finalName>${artifactId}-${revisao_svn}</finalName>
And Jenkins could be configured to pass the ${revisao_svn}
parameter to Maven.
If you use a hook like the of this page
a>, then you will have the revision number in a property.
Finally, you just have to configure build parameters as explained this link . According to this answer this is perfectly possible.
Note : I currently do not have an environment to test all this, so unless someone gives you a more detailed solution, you'll have to uncover the details of the procedure.