How do I invoke two different profiles in one maven command?

后端 未结 4 2164
孤城傲影
孤城傲影 2020-12-14 05:11

I have two profiles for different environments in pom.xml, I have to run mvn -PTest1 install and mvn -PTest2 install command to get th

相关标签:
4条回答
  • 2020-12-14 05:55

    Based on the documentation and discussion here, try separating profile names with a comma:

    mvn install -P Test1,Test2
    
    0 讨论(0)
  • 2020-12-14 05:59

    For me Mifeet's answer isn't working. I get "unknown lifecycle phase Test2". For me this is working:

    mvn install -PTest1 -PTest2
    
    0 讨论(0)
  • 2020-12-14 06:02

    Based on the maven help command

     -P,--activate-profiles <arg>   Comma-delimited list of profiles to activate
    

    So you can run mvn package -Pp1,p2 to run profile id with p1 and p2

    0 讨论(0)
  • 2020-12-14 06:10

    Mifeet's answer is correct, but in Windows PowerShell you should quote parameters, otherwise you'll get "unknown lifecycle phase" error.

    mvn install -P 'Test1,Test2'
    
    0 讨论(0)
提交回复
热议问题