我有一个超级pom:
<resources>
<resource>
<filtering>true</filtering>
<directory>(path to my project)\src\main\resources</directory>
<includes>
<include>**/application*.yml</include>
<include>**/application*.properties</include>
</includes>
</resource>
<resource>
<directory>(path to my project)\src\main\resources</directory>
<excludes>
<exclude>**/application*.yml</exclude>
<exclude>**/application*.properties</exclude>
</excludes>
</resource>
</resources>
案例是:
当我将下面的代码放在我的项目的pom中时,会自动覆盖super pom配置:
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>my-project/src/main/resources</directory>
<excludes>
<exclude>*.yml</exclude>
</excludes>
</resource>
</resources>
</build>
我如何使用super pom配置和&#34; concat&#34;我的项目是:
<resources>
<resource>
<filtering>true</filtering>
<directory>(path to my project)\src\main\resources</directory>
<includes>
<include>**/application*.yml</include>
<include>**/application*.properties</include>
</includes>
</resource>
<resource>
<directory>(path to my project)\src\main\resources</directory>
<excludes>
<exclude>**/application*.yml</exclude>
<exclude>*.yml</exclude> <!-- my project pom config -->
<exclude>**/application*.properties</exclude>
</excludes>
</resource>
</resources>
答案 0 :(得分:1)
当我学习Maven时,我也注意到子模块中定义的任何资源优先于父POM中的资源。让他们联合起来的唯一方法就是让他们联合起来。如上所述是在子节点中重复父配置,然后像您一样添加新选项。这是Maven 3.2,不确定以后的版本是否有更好的处理方法。 Plugins have an explicit way to say 'merge',请参阅combine.children和相关属性。