Maven配置文件依赖于另一个配置文件

时间:2015-06-10 06:03:03

标签: maven maven-2

当我执行mvn clean install时,它将运行默认的活动maven配置文件和主POM。

当我执行mvn clean install -P anotherProfile时,它正在执行默认的活动maven配置文件+ anotherProfile。

但是如果默认配置文件失败,我不希望另一个配置文件运行。我会这样做吗?

例如:

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

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

1 个答案:

答案 0 :(得分:0)

如果您希望激活一个配置文件但要禁用另一个配置文件,则可以使用!禁用它:

$this->modelName->function()

将激活profile1

mvn install -P profile1

将激活profile2但取消激活profile1

您可以使用激活配置文件来打开或关闭它们,具体取决于某些属性,而不依赖于手动激活。

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

相关问题