Apache Maven POM Inheritance


Example

Inheritance is the biggest asset of the POM, where the following can be managed from super POM to child POM.

  • dependencies
  • developers and contributors
  • plugin lists (including reports)
  • plugin executions with matching ids
  • plugin configuration

The following enables the inheritance

  <parent>
    <groupId>com.sample</groupId>
    <artifactId>sample-app-parent</artifactId>
    <version>1.0.0</version>
  </parent>

POM structure looks like

<project>
  <parent>
    <groupId>com.sample</groupId>
    <artifactId>sample-app-parent</artifactId>
    <version>1.0.0</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sample</groupId>
  <artifactId>sample-app</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</project>