1

I am using Jenkins server with perforce. My build get stored in a local repo path in ".zip" format which contains all the file including (say) abc.properties. This file contains data:

#Thu Jun 09 12:13:14 MSD 2011
BuildType=dev
FrameworkBuild=200
ProductVersion=4.40.00
SoftwareFeatureID=34670101
BuildNumber=0
FrameworkVersion=2.47.00

In this abc.properties file BuildNumber = 0 is a default value(set in perforce). My old build system updates the BuildNumber value with current build number in the zip file.

How can I achieve the same in Jenkins.

Thanks in advance.

Peter Schuetze
  • 16,185
  • 4
  • 44
  • 58
vicky
  • 29
  • 1
  • 3
  • 9

3 Answers3

10

Add a post build step. This assumes you are running Unix and have sed on the path.

sed -i -e '/BuildNumber =/ s/= .*/= "$BUILD_NUMBER";/' abc.properties

Also, I could not disagree more with the selected answer. Jenkins is a build tool.

Jenkins focuses on the following two jobs: Building/testing software projects continuously https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins

doublesharp
  • 26,888
  • 6
  • 52
  • 73
John Moses
  • 1,283
  • 1
  • 12
  • 18
1

I am not sure what kind of build do you run. If you have a maven or ant project, these two frameworks will update the property file if you ask them to.

Peter Schuetze
  • 16,185
  • 4
  • 44
  • 58
-4

Use maven or gradle for this, jenkins is not a build tool.

MariuszS
  • 30,646
  • 12
  • 114
  • 155
  • Can I achieve this through "Execute Windows Batch File" in build environment. If it so. How? Please help – vicky Nov 18 '13 at 06:08