是否可以在不更改模块pom的情况下从父pom覆盖模块属性?
例如:
模块pom(我根本无法改变它):
<properties>
<someProperty>some value to be replaced</properties>
</properties>
父母:
<properties>
<someProperty>strongValue</someProperty> <!-- some magic here -->
</properties>
有效模块pom:
<properties>
<someProperty>strongValue</someProperty>
</properties>
如果是,那么如何实现呢?
答案 0 :(得分:9)
我知道这样做的唯一方法是在命令行上定义属性,例如mvn -DsomeProperty=strongValue <mvn goals/phases here>
。
您可以尝试在父级中定义的配置文件;我怀疑这无济于事。
答案 1 :(得分:8)
答案 2 :(得分:0)
子POM可以覆盖在父pom中定义的属性的值。因此,只需在子POM中放置一个节并将值设置为所需值即可。