Jenkins series -16 maven Gets the version number of Jenkins's subversion

Source: Internet
Author: User
Tags object model

The small partners in the work will always encounter a variety of wonderful needs, today to everyone talk about how maven in Jenkins get Subversion version number.

Jenkins's own environment variable contains a number of useful parameters, see details: http://xxxx/env-vars.html

From the environment variables can be found, we can directly get to Subversion version number.

The most important point is solved, and we'll find a way to get maven to get the parameters of the Jenkins environment variable.

MAVEN provides its own solution:

As mentioned in the No. 266 page of the Maven authoritative guide, there are implicit properties in any Maven project, and the implicit properties are:

project.*

MAVEN's Project object Model (POM). You can use the project.* prefix to refer to any value in the Maven Pom.

settings.*

Maven Settings. You use the settings.* prefix to refer to the value of MAVEN settings in the ~/.m2/settings.xml file

env.*

Environment variables such as path and m2_home can all be referenced using the env.* prefix.

By the above introduction know, can pass ${env. The svn_revision} parameter gets the Subversion version number in Jenkins.

Well, Maven has gotten what it needs. Now you can do whatever you want. O (∩_∩) o haha ~

Finally, I will give you a picture of my test, there is a picture of the truth amount:


Go: http://www.cnblogs.com/zz0412/p/jenkins_jj_15.html Click to open link

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.