【发布时间】:2018-07-18 19:20:40
【问题描述】:
我有两个 Maven 配置文件 P1 和 P2,我想做的是根据我用于构建项目的配置文件,应该排除某些资源。
例如
<profiles>
<profile>
<id>P1</id>
<properties>
<app.home>Path to project home</app.home>
<exclude>src/main/java/foo/*.*</exclude> <!-- need to exclude all files in src/main/java/foo in this profile -->
</properties>
</profile>
<profile>
<id>P2</id>
<properties>
<app.home>Path to project home</app.home>
<exclude>src/main/java/bar/*.*</exclude> <!-- need to exclude all files in src/main/java/bar in this profile-->
</properties>
</profile>
</profiles>
所以,在这里我要做的是在使用 P1 配置文件构建时排除 src/main/java/foo/ 中的所有文件,并在使用 P2 构建时排除 src/main/java/bar 中的所有文件个人资料。
这可能吗?如果没有,是否有其他选择?
【问题讨论】:
-
你应该使用两个独立的模块,这意味着有一个多模块构建。因为这违反了关注点分离。