Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass MAVEN profile parameter from jenkins

In my POM.xml file for my android project I have created six profiles. I run these from the command line like mvn clean install -P mdpi. This works fine. Now I am using jenkins for my CI. I want the user to be presented with a drop down list of all profiles and then use mvn clean install -P ${selected-profile} so the ${selected-profile} variable contains the profile for the build. How can i do this?

like image 202
AndroidDev Avatar asked Sep 16 '13 13:09

AndroidDev


1 Answers

I suggest you to install the parametrized build plugin which will allow you to display a list of options to your job user. To enable it you'll have to check 'this build is parametrized' option and then define option.

To be able to define list option you'll then have to install extended choice parameter plugin that extends the first one by adding list option (and other parameter types).

You'll then be able to define a PROFILE list option. The selected option name will be stored in the parameter name.

The maven cmdline: 'mvn clean install -P${PROFILE}' will then work as you expect.

I hope this helps!

like image 83
thesmash Avatar answered Sep 26 '22 13:09

thesmash