Project Inheritance
Introduction
Project inheritance is about sharing POM configuration between projects. See 9.5.3. Project Inheritance for a description of the concept.
There will always be a trade-off between the DRY principle and level of complexity. In other words; while Maven supports the perfect inheritance tree, many levels of inheritance may make the setup too complex.
We will now explain one rather sophisticated setup that evolved in a Norwegian company with more than 50 Maven projects.
| Full Size |
POM descriptions
Example on the Generic Parent POM Example - used by almost all projects in an organization (possibly indirectly).
- Two-level structure (inherits Generic)
- Java Parent POM Example - used by all Java projects in an organization
- JSW Daemon Parent POM Example - used by all projects deployed as Java Service Wrapper Daemons
- JSW Daemon Webapp Parent POM Example - used by all projects deployed as Java Service Wrapper Daemons with Jetty
If you only have Java projects the generic parent pom can be combined with the java parent pom to remove one level of inheritance:
- Single parent pom for only java projects
- Company parent pom example for only Java projects