我有以下父pom.xml文件Maven构建所有子模块,即使有轮廓
<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>
当我尝试用profile P1
(在IDEA 14 Maven来执行这个POM文件的compile goal
段项目窗口),它将编译模块A和B的。
但如果我删除模块部分,它将仅编译模块B(如上面所提到的配置文件)
<modules>
<module>../A</module>
<module>../B</module>
</modules>
但我想保持模块的标签,因为它是和使用配置文件仅编译模块B。有没有解决方案可以解决这个问题。
为什么不使用'mvn -pl moduleB clean package'?切勿使用配置文件包含/排除模块:http://blog.soebes.de/blog/2013/11/09/why-is-it-bad-to-activate-slash-deactive-modules-by-profiles-in- maven/ – khmarbaise