Configuring build artifacts with appropriate build numbers for Jenkins Maven project

First, you’ll need to modify your Project Object Model (POM) file a bit, allowing it to accept variables on its version tag. For example:
 

<version>1.2.${v}-SNAPSHOT</version>

where v is the name of the variable that should be retrieved when running the job. Here’s a sample, POM snippet:

User-added image

Next, as regards to your Jenkins (Maven project) job configuration, you’ll need to edit the Goals and Options field. In your POM file, the value referenced in ${} should be the same as that which you’re using for Goals and Options. For example, in the illustration above:
 

1.2.${BUILD_NUMBER}-SNAPHOT

is the defined version in the POM file. Therefore, you’ll need to configure Goals and Options as:
 

clean install -Dv=${BUILD_NUMBER}

which you can see here:

User-added image

where {BUILD_NUMBER} is the value that you’re currently running on Jenkins, which will be captured in the variable "v". The name of the artifacts, which will be deployed to Artifactory, will look similar to the following:

User-added image

"18" is the deployed build number in the Jenkins. Therefore, the package has been deployed with the name 1.2.18-SNAPSHOT as it was declared as 1.2.${v}-SNAPHOT in the POM file.