Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Ant and dynamic build.properties files

Tags:

jenkins

ant

I have a single code based being used to build an application for multiple platforms.

Locally I have setup a main build-env.properties file, and a series of additional *.properties files that I use to switch settings for the different platforms I am publishing to.

Doing my build on the command line I simply use the command:

ant build -propertyfile dev-build.properties

How can I do this in Jenkins?

I currently use the "Invoke Ant" Build Step with the target set to build, but am at a loss for how to specify the secondary propertyfile?

like image 867
JRobbins Avatar asked Oct 06 '22 19:10

JRobbins


2 Answers

Although not exactly the same, you can take the contents of those properties and put them into the Jenkins Invoke Ant build step, utilizing the properties advanced field.

The most basic way:

  • You will need to create a new task for each different set of sub properties you wish to utilize.

  • In your "Invoke Ant" build step, if you press Advanced..., this reveals a "Properties" field, you can copy the properties from one of your *.properties files into that field.

  • Repeat for each different properties file you wish to utilize.

like image 160
ashurexm Avatar answered Oct 10 '22 04:10

ashurexm


Parametrized build plugin might help you. This is assuming the number of properties you are changing is one or two. So when you run a job, you get a drop-down to select you OS and go.

Though, as I have mentioned here , what goes against this plugin is that it makes the process manual


On this thread Hudson / Jenkins: share parameters between several jobs you can read the 2nd option in Anders's answer as an alternate approach.

like image 30
Pulak Agrawal Avatar answered Oct 10 '22 02:10

Pulak Agrawal