What do <parent> and <dependencyManagement> (BOM) help with in a pom?
Options
- Naming the project and listing all of its modules
- Centralizing versions so modules stay consistent (Correct option)
- Running the tests faster using parallel threads
- Publishing the project to Git on every build
Answer
Centralizing versions so many dependencies and modules stay consistent without repeating version numbers
Why
<parent>: your pom inherits configuration from another pom. spring-boot-starter-parent sets plugin defaults and dependency versions.
<dependencyManagement>: lists versions in one place. Children and dependencies then omit <version>. A BOM (Bill of Materials) is a pom that only does this, such as spring-boot-dependencies; you import it and get a tested set of compatible versions.
Benefits: fewer conflicts, one place to upgrade, multi-module projects stay aligned.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.0</version>
</parent>Remember
Parent pom or BOM = one place that decides versions.