Spring Boot - parent pom when you already have a parent pom
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
If your Maven project already has a parent POM, you cannot also inherit directly from spring-boot-starter-parent, because Maven supports only one parent. The usual solution is to keep your existing parent and import Spring Boot’s dependency BOM with spring-boot-dependencies instead.
Why the Conflict Exists
Maven allows a single <parent> element:
That means you cannot also do this in the same POM:
So the real question is not “how do I use both parents,” but “how do I keep my existing parent and still get Spring Boot’s dependency management.”
Use the Spring Boot BOM
Import spring-boot-dependencies in dependencyManagement:
This gives you Spring Boot’s managed dependency versions while preserving your existing parent hierarchy.
What You Do Not Get Automatically
Using the BOM is not identical to inheriting from spring-boot-starter-parent. The starter parent also provides plugin defaults and some build configuration conveniences.
When you keep your own parent, you may need to configure the Spring Boot Maven plugin yourself:
That is normal. Dependency management and plugin configuration are related, but they are not the same thing.
Why This Pattern Is Common
Many organizations already have a corporate parent POM that controls:
- repository settings
- plugin versions
- code quality rules
- internal publishing policies
Replacing that parent just to inherit from Spring Boot is often the wrong tradeoff. Importing the Spring Boot BOM lets you adopt Boot’s dependency alignment without breaking the organization’s Maven structure.
Multi-Module Projects
In a multi-module build, a common pattern is:
- keep the corporate parent at the top
- import Spring Boot BOM in the application module or shared dependency-management layer
- configure Spring Boot plugins where needed
This keeps version management centralized and predictable.
Why the BOM Approach Fits Better
Most teams want Boot’s version alignment, not necessarily Boot’s entire parent hierarchy. Importing the BOM delivers that alignment while leaving corporate build rules, repository definitions, and parent-level conventions untouched.
That is usually the least disruptive integration path for established enterprise builds with existing Maven conventions and tooling already in place today generally.
Plugins Still Need a Decision
When you do not inherit from spring-boot-starter-parent, decide explicitly where the Spring Boot Maven plugin configuration belongs. Some teams put it in the application module, while others manage it from a higher-level shared parent through pluginManagement for better consistency.
Common Pitfalls
One common mistake is trying to nest two parents conceptually and expecting Maven to merge them. Maven does not work that way.
Another issue is importing Spring Boot’s BOM and then forgetting to configure the Spring Boot plugin explicitly when the build needs it.
A third pitfall is overriding managed dependency versions casually. Once you import the BOM, custom overrides should be deliberate and rare.
Summary
- Maven supports only one parent POM.
- If you already have a parent, do not try to inherit from
spring-boot-starter-parentas well. - Import
spring-boot-dependenciesas a BOM independencyManagement. - Configure the Spring Boot Maven plugin explicitly if needed.
- This pattern is the standard way to use Spring Boot within an existing Maven parent structure.
Related reading
- Spring Boot - property could not be resolved in xml from application.properties
- Spring Boot - redirect to a different controller method
- Spring boot - return user object after log in
- Spring boot - Service class calling another Service class
- Spring Boot - Validations stopped working after upgrade from 2.2.5 to 2.3.0
- Spring Boot - Wait for web server to start
- spring Boot -status405,errorMethod Not Allowed
- Spring Boot 1.4 DataJpaTest - Error creating bean with name 'dataSource

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.