父属性是否可以设为最终属性,以便子属性无法覆盖

2024-05-12

是否可以使模块 pom 无法覆盖父 pom 中的属性?

例如:

如果模块 pom 说:

<properties>
    <someProperty>some value to be replaced</properties>
</properties>

并且父 pom 已经将其声明为:

<properties>
    <someProperty>strongValue</someProperty>
</properties>

有效的模块pom应该是:

<properties>
    <someProperty>strongValue</someProperty>
</properties>

但目前预计是这样的:

<properties>
    <someProperty>some value to be replaced</properties>
</properties>

如果是的话如何实现呢?


不,你不能。这个想法是,如果不可能覆盖某个值,则不要使用属性。如果您没有其他选择,您可能需要强制执行http://maven.apache.org/enforcer/enforcer-rules/requireProperty.html http://maven.apache.org/enforcer/enforcer-rules/requireProperty.html如果财产的价值与预期不同,这将破坏构建。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

父属性是否可以设为最终属性,以便子属性无法覆盖 的相关文章

随机推荐