当前位置: 动力学知识库 > 问答 > 编程问答 >

jenkins - How can I edit the content of .properties file?

问题描述:

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.

网友答案:

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

网友答案:

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

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: