2013-08-28 138 views
1

我有3個模塊:如何激活配置文件並且未設置屬性來構建Maven模塊?

  • 模塊1
  • 單詞數
  • 單詞數

和3型材:

  • Profile1的
  • Profile2的
  • Profile3的

我想建立Module1如果:

  • Profile2Profile3被激活,
  • 命令行屬性skipModule1集。

不管Module1建成,Profile2Profile3應該建立(兩者)模塊Module2Module3這可以在Maven 3中實現嗎?如果是這樣,怎麼樣?

的問題,在我看來,是profiles can't activate other profiles ,我不能包括Module1Profile2Profile3部分因爲沒有辦法,我指定,如果skipModule1沒有設置Module1應該被跳過。

回答

1

儘管配置文件無法激活其他配置文件,但您仍有可能採取的解決方法。

構建時,不是明確激活Profile2和Profile3(通過-P Profile2,Profile3),而是通過使用變量激活它們,使其看起來像mvn compile -DactivateProfile2=true -DactivateProfile3=true

然後您對Profile1的要求變得直截了當:配置文件1(其中包含Module1)由activateProfile2=true, activateProfile3=true, !skipModule1

相關問題