Social Media

Maven bill of materials (bom)

The purpose of a bill of materials(bom) is to centrally manage Maven dependencies and reduce the chances of version mismatches. The concept is orignally from supply chain management where it is used to track parts.

The key points of boms are –

  • Special maven project to centrally manage dependencies
  • Managed in dependencyManagement section of type – <type>pom</type>
  • Allow dependencies to cascade down through projects using <dependencyManagement>
  • The bill of materials pom.xml will only list supported versions
  • Simplify dependency import in child projects because you do not need to specify dependency versions

Example

One advantage of bill-of-materials is that you can set out the recommended version dependencies, and use these through your application framework-

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.3.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

You can then import dependencies in sub-project pom’s without version numbers –

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>

Reference

http://docs.spring.io/spring/docs/current/spring-framework-reference/html/overview.html

About the Author Martin Farrell

My name is Martin Farrell. I have almost 20 years Java experience. I specialize inthe Spring Framework and JEE. I’ve consulted to a range of businesses, and have provide Java and Spring mentoring and training. You can learn more at About or on my consultancy website Glendevon Software

follow me on:

Leave a Comment:

1 comment
Add Your Reply