2013-08-28 48 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

相关问题