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









share|improve this question


























    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









    share|improve this question
























      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









      share|improve this question













      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 19 at 13:25









      Vortilion

      931213




      931213
























          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'






          share|improve this answer























          • 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













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          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

























          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'






          share|improve this answer























          • 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

















          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'






          share|improve this answer























          • 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















          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'






          share|improve this answer














          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'







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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




















          • 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




















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin