0

following situation: I want to build a maven project via jenkins and also be able to select multiple maven profiles (to be precise it has to build with two profiles, one of those is a fixed value called 'dev', so basically I want to be able to select the second profile from a list of profiles) before building, so a parameterized build. I add the selectable profile as a option-list and now I'm able to select it from a dropdown, so far, so good.

BUT: It seems the problem is the multiple profile part.

In the maven goal-field I type

clean install -Pdev,$Client

with 'Client' being the parameter for the build which contains the selected value.

But if I start the build, the command line says e.g.

mvn clean install "-Pdev,test"

with the problem being it wrapping the Profiles in apostrophes. If I test it with a single parameter it works as expected:

clean install -P$Client
Vortilion
  • 406
  • 2
  • 6
  • 24

1 Answers1

0

Based on the following explanation, try some of these:

#1    mvn install -P profile1,profile2
#2    mvn install -Pprofile1 -Pprofile2
#3    mvn install -P 'profile1,profile2'

Explanation

According to official documentation

The correct multi profile invocation is :

mvn groupId:artifactId:goal -P profile1,profile2

And some variations are allowed:

mvn install -Pprofile1 -Pprofile2

Ans as always :s an special treatment for windows:

mvn install -P 'profile1,profile2'

JRichardsz
  • 14,356
  • 6
  • 59
  • 94
  • As I've said in my Post, I already tried the usual "-Pprofile1,profile2", but it doesn't work... I also tried the variant "-Pprofile1 -Pprofile2. – Vortilion Nov 21 '18 at 08:10
  • Your **usual** "-Pprofile1,profile2" is **wrong**. It is similar to #1 but you need to examined in detail. I tried and worked. – JRichardsz Nov 21 '18 at 13:51
  • ? I don't understand. I tried every combination, it doesn't work if I use one dynamic and one fix profile, no matter if I wrap them in no, single or double quotes. What I meant with "usual" is that it's the normal way to call mvn clean install with multiple profiles! – Vortilion Nov 21 '18 at 13:54
  • Could you share us a maven project (hello world) in github and screenshots or how are configured your jenkins? Maybe is a jenkins version issue :s – JRichardsz Nov 21 '18 at 16:30