Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven inherited attributes from parent POM

I am trying to find an authoritative list of which elements get inherited from a parent POM. Based on this page

When you inherit a POM, you can choose to live with the inherited POM information or to selectively override it. The following is a list of items a Maven POM inherits from its parent POM:

  • identifiers (at least one of groupId or artifactId must be overridden.)
  • dependencies
  • developers and contributors
  • plugin lists
  • reports lists
  • plugin executions (executions with matching ids are merged)
  • plugin configuration

But when I see the effective POM in one of my projects I see it also inherits inceptionYear, description (which is a problem, this should be a description of the POM that contains it, not of its children. What's the point of all children having a description like "The root of all POMs")

So is there an actual list or does it just inherit everything from the parent pom? i use some of these properties in the artifact's manifest so I want to add meaningful values

like image 728
Hilikus Avatar asked Jan 08 '13 19:01

Hilikus


2 Answers

Most elements from the parent POM are inherited by its children. Two elements that aren't inherited are artifactId & name. (Also, any plugins which explicitly set <inherited>false)

like image 136
Chas Avatar answered Nov 13 '22 15:11

Chas


The child pom inherits everything from the parent pom. If you need to set meaningful values in the child pom then you will need to override the values in the parent pom.

From the Docs:

When a project specifies a parent project, Maven uses that parent POM as a starting point before it reads the current project’s POM. It inherits everything, including the groupId and version number.

like image 33
gregwhitaker Avatar answered Nov 13 '22 13:11

gregwhitaker