我有两个 Maven 配置文件 profile-A 和 profile-B。只有在“A”未激活时才应激活“B”。所以如果我打电话
mvn install
profile-B 被执行(但不是 profile-A)。但如果我打电话
mvn install -Pprofile-A
然后只执行配置文件 A(但不执行配置文件 B)。
任何提示我需要如何编写我的 pom.xml 来实现这一点?
我已经尝试过了,但它不起作用:
<profiles>
<profile>
<id>profile-A</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
...
</profile>
<profile>
<id>profile-B</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>!profile-A</name>
</property>
...
</activation>
...
</profile>
</profiles>