我在父pom.xml文件中有以下段
<groupId>my.group</groupId>
<artifactId>artifact</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>../A</module>
<module>../B</module>
</modules>
<profiles>
<profile>
<id>P1</id>
<modules>
<module>../B</module>
</modules>
</profile>
<profiles>
当我尝试使用compile goal
(在IDEA 14 Maven项目窗口中)执行此pom文件的profile P1
时,它将编译模块A和B 。
但如果我删除模块段,它将只编译模块B.(如配置文件中所述)
<modules>
<module>../A</module>
<module>../B</module>
</modules>
但我想保持模块标签不变,并且使用配置文件仅编译模块B 。有没有解决方案来解决这个问题。
答案 0 :(得分:2)
您必须创建单独的配置文件以构建模块A和B.您可以默认激活此配置文件。所以这不会改变现有的行为。
<groupId>my.group</groupId>
<artifactId>artifact</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<profiles>
<profile>
<id>P1</id>
<modules>
<module>../B</module>
</modules>
</profile>
<profile>
<id>Everything</id>
<modules>
<module>../A</module>
<module>../B</module>
</modules>
</profile>
<profiles>