Is it possible to make properties in parent pom not overridable by the module pom?
For example:
if module pom says:
<properties>
<someProperty>some value to be replaced</properties>
</properties>
and parent pom already has it declared as:
<properties>
<someProperty>strongValue</someProperty>
</properties>
effective module pom should be:
<properties>
<someProperty>strongValue</someProperty>
</properties>
but it is currently expected to be this:
<properties>
<someProperty>some value to be replaced</properties>
</properties>
If yes then how to achieve it?
Overriding configurations from a parent pom can be done by adding the combine. self="override" attribute to the element in your pom.
Plugins declared outside of <pluginManagement> are inherited by child POMs, by default. Their settings can be overridden by each child if desired.
Maven supports project inheritance. You can create a parent project that contains properties child projects have in common, and child projects inherit those properties from the parent project.
No, you can't. The idea is that if it shouldn't be possible to override a value, don't use a property. If you have no other option, you might want to force it with http://maven.apache.org/enforcer/enforcer-rules/requireProperty.html which will break the build if a property has a different value than expected.
Only way I know to do this for sure is to define the property on the command line, e.g. mvn -DsomeProperty=strongValue <mvn goals/phases here>
.
You might experiment with profiles defined in the parent; I suspect that won't help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With