Maven parent pom vs modules pom
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
In Maven, "parent POM" and "modules POM" are related ideas, but they are not the same concept. A parent POM is about inheritance of configuration. A POM with a modules section is about aggregation and build coordination. One file can play both roles, but you should understand them separately or multi-module builds become confusing very quickly.
What a Parent POM Does
A parent POM provides shared configuration that child projects inherit. Typical parent-level content includes:
- dependency versions in
dependencyManagement - plugin versions in
pluginManagement - shared properties
- repository and build settings
A child module points to the parent using the parent section.
That tells Maven to inherit configuration from the parent POM.
What a Modules POM Does
A POM with a modules section is an aggregator. Its job is to tell Maven which subprojects belong to the build.
When you run Maven at this top level, it builds the listed modules in the right order.
So aggregation is about "which projects are in this build." Inheritance is about "which configuration do these projects share."
One POM Can Be Both
A common structure is a top-level POM that acts as both:
- the parent for child modules
- the aggregator that lists those modules
That is common, but it is a design choice, not a Maven rule.
They Can Also Be Separate
Large organizations sometimes separate the roles.
For example:
- one corporate parent POM provides standard plugin and dependency management
- another aggregator POM collects the modules for a particular build
This is useful when many projects share the same parent but are not part of the same multi-module reactor build.
How Child Modules Usually Look
A child module typically inherits from the parent and defines its own artifact-specific dependencies.
The dependency version can be omitted because the parent manages it.
dependencyManagement Is Not the Same as Modules
Another source of confusion is mixing up dependency inheritance with project aggregation. The modules section tells Maven which subprojects participate in the reactor build. dependencyManagement tells child projects which dependency versions to inherit when they declare those dependencies.
Those are different jobs:
- '
modulescontrols build composition' - '
dependencyManagementcontrols version alignment'
Understanding that distinction helps explain why a parent POM often contains both sections even though they solve separate problems.
The Core Difference
The cleanest summary is:
- parent POM: controls inheritance
- modules POM: controls aggregation
That is why a POM can list modules without being their parent, and a POM can be a parent without listing modules at all.
Common Pitfalls
- Assuming any POM with
modulesautomatically acts as the parent for those modules. - Assuming any parent POM must also aggregate modules in the same repository.
- Putting dependency versions directly in each child instead of centralizing them in
dependencyManagement. - Confusing
dependencyManagementinheritance with actual dependency inclusion. - Forgetting that
packagingshould usually bepomfor parent or aggregator POMs.
Summary
- A parent POM is for inheritance of shared Maven configuration.
- A modules POM is for aggregating subprojects into one reactor build.
- One top-level POM can serve both roles, but they are still separate concepts.
- Child modules usually reference the parent with the
parentelement. - Understanding inheritance versus aggregation makes multi-module Maven builds much easier to reason about.

