Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use BOM file with Maven?

Tags:

maven

jboss

I have done considerable research in internet and I haven't found any easy explanation what to do with BOM files with Maven.

The problem is that I use JBoss 7.1.1 and I want to include all JBoss client jars in pom.xml. JBoss has a manual that says that I should use BOM files, but I don't know how to use it in my pom.xml.

Please help.

like image 275
user2071995 Avatar asked Feb 14 '13 12:02

user2071995


People also ask

What is use of BOM in Maven?

What Is Maven BOM? BOM stands for Bill Of Materials. A BOM is a special kind of POM that is used to control the versions of a project's dependencies and provide a central place to define and update those versions.

What is Maven BOM in gradle?

Importing Maven BOMs 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.

What is BOM import?

The BOM Import module, located in the Integrations group, is an add-on module that can be installed from the. Plugin module. After installing the plugin, a new module is added that allows the user to import files (csv, xlsx, xls), create a mapping, and import the needed parts, products, and BOMs.


1 Answers

A bom is a so called bill of materials - it bundles several dependencies to assure that the versions will work together. JBoss has boms for many of it's projects, including Arquillian and the JBoss AS itself.

There is an explanation of the bom usage in the maven docs - it is hidden well below.

A practical example:

You include the bom into your pom like this:

<dependencyManagement>     <dependencies>         <dependency>             <groupId>org.jboss.bom</groupId>             <artifactId>jboss-javaee-6.0-with-tools</artifactId>             <version>${javaee6.with.tools.version}</version>             <type>pom</type>             <scope>import</scope>         </dependency>     </dependencies> </dependencyManagement>  

Then you do not have to specify the version attribute of a dependency, if it is defined in the bom like this:

<dependency>     <groupId>javax.enterprise</groupId>     <artifactId>cdi-api</artifactId>     <scope>provided</scope> </dependency> 
like image 183
kostja Avatar answered Oct 05 '22 18:10

kostja