Jenkins: Pass multiple MAVEN profiles via user selection
up vote
0
down vote
favorite
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
maven jenkins extended-choice-parameter
add a comment |
up vote
0
down vote
favorite
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
maven jenkins extended-choice-parameter
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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
maven jenkins extended-choice-parameter
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
maven jenkins extended-choice-parameter
maven jenkins extended-choice-parameter
asked Nov 19 at 13:25
Vortilion
931213
931213
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
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
- https://maven.apache.org/guides/introduction/introduction-to-profiles.html
The correct multi profile invocation is :
mvn groupId:artifactId:goal -P profile1,profile2
And some variations are allowed:
- https://stackoverflow.com/a/16792775/3957754
- https://stackoverflow.com/a/42766252/3957754
mvn install -Pprofile1 -Pprofile2
Ans as always :s an special treatment for windows:
mvn install -P 'profile1,profile2'
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 at 8: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 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 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 at 16:30
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
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
- https://maven.apache.org/guides/introduction/introduction-to-profiles.html
The correct multi profile invocation is :
mvn groupId:artifactId:goal -P profile1,profile2
And some variations are allowed:
- https://stackoverflow.com/a/16792775/3957754
- https://stackoverflow.com/a/42766252/3957754
mvn install -Pprofile1 -Pprofile2
Ans as always :s an special treatment for windows:
mvn install -P 'profile1,profile2'
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 at 8: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 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 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 at 16:30
add a comment |
up vote
0
down vote
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
- https://maven.apache.org/guides/introduction/introduction-to-profiles.html
The correct multi profile invocation is :
mvn groupId:artifactId:goal -P profile1,profile2
And some variations are allowed:
- https://stackoverflow.com/a/16792775/3957754
- https://stackoverflow.com/a/42766252/3957754
mvn install -Pprofile1 -Pprofile2
Ans as always :s an special treatment for windows:
mvn install -P 'profile1,profile2'
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 at 8: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 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 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 at 16:30
add a comment |
up vote
0
down vote
up vote
0
down vote
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
- https://maven.apache.org/guides/introduction/introduction-to-profiles.html
The correct multi profile invocation is :
mvn groupId:artifactId:goal -P profile1,profile2
And some variations are allowed:
- https://stackoverflow.com/a/16792775/3957754
- https://stackoverflow.com/a/42766252/3957754
mvn install -Pprofile1 -Pprofile2
Ans as always :s an special treatment for windows:
mvn install -P 'profile1,profile2'
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
- https://maven.apache.org/guides/introduction/introduction-to-profiles.html
The correct multi profile invocation is :
mvn groupId:artifactId:goal -P profile1,profile2
And some variations are allowed:
- https://stackoverflow.com/a/16792775/3957754
- https://stackoverflow.com/a/42766252/3957754
mvn install -Pprofile1 -Pprofile2
Ans as always :s an special treatment for windows:
mvn install -P 'profile1,profile2'
edited Nov 21 at 13:48
answered Nov 19 at 14:08
JRichardsz
1,5301237
1,5301237
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 at 8: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 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 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 at 16:30
add a comment |
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 at 8: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 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 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 at 16:30
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 at 8:10
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 at 8: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 at 13:51
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 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 at 13:54
? 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 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 at 16:30
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 at 16:30
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375634%2fjenkins-pass-multiple-maven-profiles-via-user-selection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown