Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Bill-Of-Materials in Maven dependency management? [closed]

What is the significant use of Bill-Of-Materials features available in the new Spring release, basically the name sounds good but searched for significant but I fail to find it?

like image 672
Pushkar Avatar asked Nov 24 '14 07:11

Pushkar


People also ask

Can a BOM have a parent?

You can only have one parent, but you can import multiple BOMs into your Maven project. Also, importing a BOM will only import the dependencyManagement, while having a parent will import everything you have in that pom.

What is Maven BOM in gradle?

Maven's dependency management includes the concept of a bill-of-materials (bom). A bom is a special kind of pom that is used to control the versions of a project's dependencies and provides a central place to define and update those versions.

What is dependency management in Maven?

What Is Maven Dependency Management? Dependency management in Maven allows teams to manage dependencies for multi-module projects and applications. These can consist of hundreds or even thousands of modules. Using Maven can help teams define, create, and maintain reproducible builds.

What is Bill Of Materials gradle?

Gradle provides support for importing bill of materials (BOM) files, which are effectively .pom files that use <dependencyManagement> to control the dependency versions of direct and transitive dependencies. The BOM support in Gradle works similar to using <scope>import</scope> when depending on a BOM in Maven.


1 Answers

The Bill Of Materials (aka BOM) is more a Maven concept than a Spring one. It has emerged with the 2.0.x release of Maven when the import scope has been introduced.

This scope let you declare a pom dependency inside your <dependencyManagement> section which will result in a sort of merge of the dependency and its dependant project dependencyManagement section.

The BOM concept came to put that scope in practice, which is no more than a project with a pom.xml having as packaging nature pom and that has only the <dependencyManagement> sectin inside in which we declare all the project dependencies (in your case it should be Spring ones) that are aligned together and should work out of the box.

You can think of a BOM project as a dependency directory that declares all the related projects versions thus save your version resolution efforts.

One your BOM imported into your project descriptor, you no more need to declare the version when declaring a dependecy because it will be inherited from that imported pom and it should the be something like the following:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-core</artifactId> <!-- or any other spring related artifact -->
</dependency>
like image 87
tmarwen Avatar answered Sep 28 '22 00:09

tmarwen