All 15 Build Tools: Maven & Gradle questions
More in Build Tools: Maven & Gradle
Advertisement
Java › Build Tools: Maven & Gradle

What is a Maven BOM (Bill of Materials), and how does it help manage consistent dependency versions across a multi-module project or organization?

Intermediate

Answer

A BOM is a special pom.xml (packaging type "pom") that declares a curated, consistent set of dependency versions inside <dependencyManagement> without actually including those dependencies itself -- importing a BOM via <scope>import</scope> lets your project's own dependency declarations omit explicit version numbers entirely (inheriting the BOM's version), ensuring all dependencies from a related family (like Spring Boot's own BOM covering dozens of compatible Spring ecosystem libraries) stay mutually compatible without manually tracking each version yourself.
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>3.2.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<!-- No version needed -- inherited from the imported BOM -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
Real-world example A Spring Boot project imports the spring-boot-dependencies BOM, letting every Spring-related dependency declaration across the entire project omit explicit version numbers, guaranteeing all the interdependent Spring modules stay on mutually-tested, compatible versions as a cohesive set rather than needing manual version coordination.

Common follow-ups: How would an organization create and publish its own internal BOM to standardize dependency versions across many internal projects?;What's Gradle's equivalent mechanism for importing a BOM (the platform() function)?