Is there any way a Jenkins build can be aware of the Maven version number of a project after processing the POM?
I've got some projects where versioning is controlled by Maven, and in a post-build job we'd like to create a Debian package and call some shell scripts. What I need is for the version number that Maven used to be available as a Jenkins environment variable so I can pass it to post-build actions.
To be clear, I'm not needing to know how to get Jenkins to pass a version number to Maven; instead I want Maven to pass a version number to Jenkins!
version. It is the sub element of project. It specifies the version of the artifact under given group. File: pom.xml.
The version number of the artifact defined in the POM file is the same as the version number of the released product, for example 12.1. 2.0. 0, expressed using five digits, as described in the following: In x.x.x-y-z : x.x.x is the release version number, for example 12.1.
You can use the ${POM_VERSION} variable, which was introduced with https://issues.jenkins-ci.org/browse/JENKINS-18272
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With