how to include Jenkins Build Number in Ant script - quick question

2,251 views
Skip to first unread message

Z W

unread,
Nov 29, 2012, 10:20:34 PM11/29/12
to jenkins...@googlegroups.com
Hi

We like to sync up Jenkins build number with our version.xml file.
Is there a way to include Jenkins build number in our main ant script
build.xml so that it would write to our version.xml ?

Thanks

Benjamin Lau

unread,
Nov 29, 2012, 10:22:51 PM11/29/12
to jenkins...@googlegroups.com
Take a look at XmlTask for Ant. You can then update your xml file using xpath.

Ben

[1] http://www.oopsconsultancy.com/software/xmltask/

Andreas Schilling

unread,
Nov 30, 2012, 2:30:20 AM11/30/12
to jenkins...@googlegroups.com
Hi,

your case sounds like you simply need to pick up the environment variable in your ant script:

<property environment="env" />

Then you can use the following variables:
https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables

e.g. ${env.BUILD_NUMBER}

Kind regards,

Andreas Schilling
CAE Processes & Data Management
-------------------------------------------------------------------
Dipl. Inf. Andreas Schilling
Senior Software Architect

TWT GmbH
Science & Innovation
Bernhäuser Str. 40 - 42
73765 Neuhausen

Tel: +49 - 7158 - 17 15 - 673
E-Mail: andreas....@twt-gmbh.de
--------------------------------------------------------------------
www.twt-gmbh.de
--------------------------------------------------------------------
Geschäftsführung: Dimitrios Vartziotis, Joachim Laicher (stv.)
Registergericht: Amtsgericht Stuttgart, HRB Nr. 212778
Umsatzsteuer: ID-Nr.: DE147841145
--------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages