Jenkins Ant and dynamic build.properties files

I have one code used to create an application for multiple platforms.

Locally, I installed the main build-env.properties file and a number of additional * .properties files, which I use to switch settings for the different platforms that I publish.

When performing my build on the command line, I just use the command:

ant build -propertyfile dev-build.properties 

How can I do this in Jenkins?

I am currently using the "Invoke Ant" command with the build target set, but I don’t understand how to specify an additional properties file?

+4
source share
3 answers

Although this is not quite the same, you can take the contents of these properties and put them in the Jenkins Invoke Ant build step using the extended property field.

The easiest way:

  • You will need to create a new task for each other set of additional properties that you want to use.

  • In the "Invoke Ant" step, if you click Advanced ... , it will open the "Properties" field, you can copy the properties from one of your * .properties files into this field.

  • Repeat for each property file that you want to use.

+2
source

Perhaps the Parametrized build plugin might help you. This assumes that the number of properties you are changing is one or two. Therefore, when you start the task, you get a drop-down list to select the OS and go.

Although, as I mentioned here , what goes against this plugin is that it does a process guide


In this thread, Hudson / Jenkins: exchange parameters between several tasks , you can read the second option in Anders' answer as an alternative approach.

+2
source

The best approach for this is to use a parameterized job with a file parameter (see doc for creating assemblies). Mentioning the file location as a " propertyfile " will help. This would be better than reconfiguring the job over and over to start the build (to copy the properties file to the input location).

0
source

All Articles