2.3.4. Manage Project Dependencies

This topic describes the usage of Bill of Materials (BOM) POMs for Red Hat JBoss Enterprise Application Platform 6.
A BOM is a Maven pom.xml (POM) file that specifies the versions of all runtime dependencies for a given module. Version dependencies are listed in the dependency management section of the file.
A project uses a BOM by adding its groupId:artifactId:version (GAV) to the dependency management section of the project pom.xml file and specifying the <scope>import</scope> and <type>pom</type> element values.

Note

In many cases, dependencies in project POM files use the provided scope. This is because these classes are provided by the application server at runtime and it is not necessary to package them with the user application.

JBoss JavaEE Specs Bom

The jboss-javaee-6.0 BOM contains the Java EE Specification API JARs used by JBoss EAP.
To use this BOM in a project, add a dependency for the GAV that contains the version of the JSP and Servlet API JARs needed to build and deploy the application.
The following example uses the 3.0.2.Final-redhat-4 version of the jboss-javaee-6.0 BOM.
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.jboss.spec</groupId>
      <artifactId>jboss-javaee-6.0</artifactId>
      <version>3.0.2.Final-redhat-4</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
    ...
  </dependencies>
</dependencyManagement>

<dependencies>
  <dependency>
    <groupId>org.jboss.spec.javax.servlet<groupId>
    <artifactId>jboss-servlet-api_3.0_spec</artifactId>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>org.jboss.spec.javax.servlet.jsp</groupId>
    <artifactId>jboss-jsp-api_2.2_spec</artifactId>
    <scope>provided</scope>
  </dependency>
  ...
</dependencies>

JBoss BOM and Quickstarts

The JBoss BOMs are located in the jboss-bom project at https://github.com/jboss-eap/jboss-bom.
The quickstarts provide the primary use case examples for the Maven repository. The following table lists the Maven BOMs used by the quickstarts.

Table 2.1. JBoss BOMs Used by the Quickstarts

Maven artifactId Description
jboss-javaee-6.0-with-errai This BOM builds on the Java EE full profile BOM, adding the Errai framework and the Google Web Toolkit (GWT) plus its Maven plugin.
jboss-javaee-6.0-with-hibernate This BOM builds on the Java EE full profile BOM, adding Hibernate Community projects including Hibernate ORM, Hibernate Search and Hibernate Validator. It also provides tool projects such as Hibernate JPA Model Gen and Hibernate Validator Annotation Processor.
jboss-javaee-6.0-with-hibernate3 This BOM builds on the Java EE full profile BOM, adding Hibernate Community projects including Hibernate 3 ORM, Hibernate Entity Manager (JPA 1.0) and Hibernate Validator.
jboss-javaee-6.0-with-infinispan This BOM builds on the Java EE full profile BOM, adding Infinispan.
jboss-javaee-6.0-with-logging This BOM builds on the Java EE full profile BOM, adding the JBoss Logging Tools and Log4 framework.
jboss-javaee-6.0-with-osgi This BOM builds on the Java EE full profile BOM, adding OSGI.
jboss-javaee-6.0-with-security This BOM builds on the Java EE full profile BOM, adding Picketlink.
jboss-javaee-6.0-with-tools This BOM builds on the Java EE full profile BOM, adding Arquillian to the mix. It also provides a version of JUnit and TestNG recommended for use with Arquillian.
jboss-javaee-6.0-with-transactions This BOM includes a world class transaction manager. Use the JBossTS APIs to access its full capabilities.
The following example uses the 1.0.4.Final-redhat-9 version of the jboss-javaee-6.0-with-hibernate BOM.
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.jboss.bom</groupId>
      <artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
      <version>1.0.4.Final-redhat-9</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
    ...
  </dependencies>
</dependencyManagement>

<dependencies>
  <dependency>
    <groupId>org.hibernate<groupId>
    <artifactId>hibernate-core</artifactId>
    <scope>provided</scope>
  </dependency>
  ...
</dependencies>

JBoss Client BOMs

The JBoss EAP server build includes two client BOMs: jboss-as-ejb-client-bom and jboss-as-jms-client-bom.
The client BOMs do not create a dependency management section or define dependencies. Instead, they are an aggregate of other BOMs and are used to package the set of dependencies necessary for a remote client use case.
The following example uses the 7.2.1.Final-redhat-10 version of the jboss-as-ejb-client-bom client BOM.
<dependencies>
  <dependency>
    <groupId>org.jboss.as<groupId>
    <artifactId>jboss-as-ejb-client-bom</artifactId>
    <version>7.2.1.Final-redhat-10</version>
    <type>pom</type>
  </dependency>
  ...
</dependencies>

This example uses the 7.2.1.Final-redhat-10 version of the jboss-as-jms-client-bom client BOM.
<dependencies>
  <dependency>
    <groupId>org.jboss.as<groupId>
    <artifactId>jboss-as-jms-client-bom</artifactId>
    <version>7.2.1.Final-redhat-10</version>
    <type>pom</type>
  </dependency>
  ...
</dependencies>


For more information about Maven Dependencies and BOM POM files, see Apache Maven Project - Introduction to the Dependency Mechanism.