Maven Project Inheritance
Fleeting- External reference: https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#project-inheritance
The Super POM is one example of project inheritance
— https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#project-inheritance
A maven project inherits from another pom (by default the super pom) to gain its configuration:
- dependencies
- developers and contributors
- plugin lists (including reports)
- plugin executions with matching ids
- plugin configuration
- resources
— https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#project-inheritance
Thus, in a big project, you generally have all the common configuration in pom at the toplevel of the project and have all the modules use this pom as a so called parent.
But what if the parent is not yet installed
— https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#project-inheritance
In the case the parent pom does not represent modularity, but common configuration, there is no need to have it in a toplevel directory.
To address this directory structure (or any other directory structure), we would have to add the <relativePath> element to our parent section
— https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#project-inheritance
In that case, one would want the parent to be at least aside the project that inherit from it, and use the relativePath instruction.
Notes linking here
- best practices for structuring maven projects and modules
- difference between maven inheritance (parent) and maven aggregation (module)
- how to correctly structure a maven project
- Maven getting started guide
- maven multi-modules project, installing the parent and incremental building
- maven packages in the gitlab package repository
- maven project aggregation
- Project Object Model