I was curious how to decide whether our element in child pom will override the parent pom detail or just get added along with the parent pom inherited elements in child pom.
Let us take an example to understand :
For example, each dependency is uniquely identified by maven coordinates. In child pom, if a dependency has maven coordinate different from dependencies in parent pom, then no overriding happens and parent dependencies are added into child pom too.
Here we had a criteria of unique identification of an element in our maven xml which helped us to identify whether or not, overriding will take place.
Another example:
Let us take another example of <license>
tag. Doing some experiment using effective pom, I came to know, that <licenses>
are inherited.
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-3.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
But if I change any one of <name>
, <url>
, <distribution>
, overriding happens.
Are there any clear cut rules when overriding happens and when it does not happen (and parent elements gets appended with child elements) without generating effective pom every time and checking it?