How to set my build’s artifacts with the build number?

First, you will need to modify the pom file a bit so that it will accept variables on the version tag.

For example:


Where ‘v’ is the name of the variable which should be retrieved when running the job.

Here is an example .pom snippet

Next, for the Jenkins job configuration (or any other CI), you will need to edit the ‘Goals and Options’ field with a value for the ‘v’ variable which was set on the .pom file.

For example:

Where {BUILD_NUMBER} is the build number value which you are currently running on Jenkins.

The name of the Artifacts which will be deployed to Artifactory will be something like the following:


Where 23 is the build number.

For example: