2015-06-10 112 views
0

当我做mvn clean install时,它将运行一个默认的活动maven配置文件和主POM。Maven配置文件依赖于另一个配置文件

当我做mvn clean install -P anotherProfile它正在执行默认的活动maven profile + anotherProfile。

但是,如果默认配置文件失败,我不希望另一个配置文件运行,我该怎么做?

如:

mvn clean install - default active profile 
mvn clean install -P anotherProfile - default+anotherProfile 

第二线工作正常,但我不希望它运行anotherprofile如果默认配置文件失败。

+0

您是在Windows/Linux/Mac OS X上? –

+0

http://stackoverflow.com/users/40064/wim-deblauwe:windows –

回答

0

如果你想要一个配置文件被激活,但另一个被禁用,你可以使用!禁用它:

mvn install -P profile1 

将启动配置文件1

mvn install -P profile2,!profile1 

将激活PROFILE2但去激活配置文件1

您可以使用的配置文件的激活开启或关闭取决于某些属性并且不依赖手动激活。

请参阅:http://maven.apache.org/guides/introduction/introduction-to-profiles.html

相关问题