Using WildFly BOMs

[Updated with the latest version of WildFly BOMs]

Maven Bill of Materials are used to keep the versions in the project using the artifacts in synch with the versions distributed in the library. The WildFly BOMs project therefore allows you to easily use your stack of choice.  

The new Home of WildFly BOM is here: https://github.com/wildfly/boms . Here is in detail how to use the single BOM files in your project.

Jakarta EE BOM

In order to build and deploy applications on WildFly 18 and newer, it is recommended to use the following BOM:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.wildfly.bom</groupId>
            <artifactId>wildfly-jakartaee8-with-tools</artifactId>
            <scope>import</scope>
            <type>pom</type>
            <version>${wildfly.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>

By including the above BOM, it will not be required to specify versions for Jakarta EE libraries included in WildFly and Arquillian artifacts. For example:

<dependency>
    <groupId>jakarta.enterprise</groupId>
    <artifactId>jakarta.enterprise.cdi-api</artifactId>
    <scope>provided</scope>
</dependency>

Please check the following article to learn how to migrate from the single WildFly dependency to Jakarta EE dependency: From Java EE to Jakarta EE with WildFly

As an alternative, if you prefer, you could use the single jakarta.jakartaee-api dependency that will catch all your Jakarta EE dependency in one shot:

<dependencies>
        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-api</artifactId>
            <version>8.0.0</version>
            <scope>provided</scope>
        </dependency>
</dependencies>

When using the jakarta.jakartaee-api you are essentally linking your project to the Jakarta EE version, rather than to the WildFly version. This means you will have to manage by yourself WildFly adds-on such as Arquillian artifacts, for example.

WildFly Client dependencies

To simplify the management of WildFly client applications, the following set of dependencies has been included in WildFly:

wildfly-ejb-client-bom

The EJB Client BOM provides application server-compatible dependency management, used for building, testing or debugging EJB client applications. You can set a single dependency on the BOM for the app to depend on all the artifacts it manages.

Example:

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-ejb-client-bom</artifactId>
    <type>pom</type>
    <scope>compile</scope>
</dependency>

wildfly-ejb-client-legacy-bom

This artifact provides a bill of materials (BOM) for remoting based EJB for clients which require 100% API compatiblity with EAP 7.0 and earlier releases. It is recommended to use the primary wildfly-ejb-client-bom if possible.

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-ejb-client-legacy-bom</artifactId>
    <type>pom</type>
    <scope>compile</scope>
</dependency>

wildfly-jms-client-bom

The JMS Client BOM provides application server-compatible dependency management, used for building, testing or debugging JMS client applications. Here is how you can import it in your project with a single dependency:

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-jms-client-bom</artifactId>
    <type>pom</type>
</dependency>

wildfly-jaxws-client-bom

The JAXWS Client BOM provides application server-compatible dependency management, used for building, testing or debugging JAXWS client applications. Here is how you can import it in your project with a single dependency:

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-jaxws-client-bom</artifactId>
    <type>pom</type>
</dependency>

Managing BOMs with WildFly 10 or older

You can find the list of available WildFly BOMs here http://central.maven.org/maven2/org/wildfly/bom/

This list can be split in two groups:

  • BOMS which are related to WildFly 8 and 9
  • BOMS which are related to WildFly 10
# WildFly 8/9 BOMS
jboss-javaee-7.0-wildfly/                           
jboss-javaee-7.0-wildfly-with-hibernate3/          
jboss-javaee-7.0-wildfly-with-tools/                
jboss-javaee-7.0-with-all/                          
jboss-javaee-7.0-with-hibernate/                   
jboss-javaee-7.0-with-hibernate3/                  
jboss-javaee-7.0-with-infinispan/                   
jboss-javaee-7.0-with-logging/                      
jboss-javaee-7.0-with-resteasy/                     
jboss-javaee-7.0-with-security/                     
jboss-javaee-7.0-with-tools/                        
jboss-javaee-7.0-with-transactions/

# WildFly 10 BOMS                 
wildfly-javaee7/                                   
wildfly-javaee7-with-tools/                         

WildFly 10 BOMS

As you can see from the above list, WildFly 10 holds just two type of BOMS: wildfly-javaee7-with-tools which includes the whole Java EE 7 stack plus the Arquillian/JUnit testing platform:

wildfly bom tutorial

and wildfly-javaee7 which just contains the Java EE 7 Dependencies:

bom wildfly10

Using the BOMS is pretty easy: include in the dependencies section the BOM which you want to use:

 <dependencyManagement>
        <dependencies>
           
            <dependency>
                <groupId>org.wildfly.bom</groupId>
                <artifactId>wildfly-javaee7-with-tools</artifactId>
                <version>10.0.0.Final</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
</dependencyManagement>

Then within your library dependencies, you won’t need to declare which version you are going to use, as this information is picked up from the BOM:

<dependency>
   <groupId>org.jboss.spec.javax.ejb</groupId>
   <artifactId>jboss-ejb-api_3.2_spec</artifactId>
   <scope>provided</scope>
</dependency>

WildFly 8/9 BOMS

The list of BOMS in WildFly 8 and 9 is more fine-grained as it contains a set of BOMS for each specific core library. Now let’s see in the detail the BOMs available. The first one is jboss-javaee-7.0-with-all which includes everything that you might need for developing, testing, logging your applications:

wildfly maven bill of materials bom tutorial

Next one is jboss-javaee-7.0-with-hibernate which enhances the default Java EE 7 stack with Hibernate ORM plus other libraries such as Hibernate Search, Hibernate Validator, Envers, the JPA Model generator.

wildfly maven bill of materials bom tutorial

The BOM jboss-javaee-7.0-with-hibernate3 adds to the default Java EE 7 stack Hibernate 3 ORM, Hibernate Entity Manager (JPA 1.0) and Hibernate Validator.

wildfly maven bill of materials bom tutorial

The BOM jboss-javaee-7.0-with-infinispan adds to the default Java EE 7 stack Infinispan native API and HotRod Client

wildfly maven bill of materials bom tutorial

The BOM jboss-javaee-7.0-with-logging adds to the default Java EE 7 stack JBoss Logging Framework and Log4J API

wildfly maven bill of materials bom tutorial

The BOM jboss-javaee-7.0-with-resteasy includes to the Java EE 7 stack some RestEasy extra goodies such as extra Providers and Async Servlet 3.0 communication

wildfly maven bill of materials bom tutorial

The BOM jboss-javaee-7.0-with-security includes to the Java EE 7 stack JBoss Negotiation Dependencies and PicketLink API

wildfly maven bill of materials bom tutorial

The BOM jboss-javaee-7.0-with-tools includes to the Java EE 7 stack Arquillian and JUnit testing features along with some extra dependencies such as Shrinkwrap or Arquillian drone

wildfly maven bill of materials bom tutorial

Finally jboss-javaee-7.0-with-transactions adds to the Java EE 7 some dependencies found in the JBoss Naranya framework including for example XTS, WS-AT and WS-BA.

wildfly maven bill of materials bom tutorial

Using the BOMS is pretty easy: include in the dependencies section the BOM which you want to use:

<dependencyManagement> 
   <dependencies>
      <dependency>
         <groupId>org.wildfly.bom</groupId>
         <artifactId>jboss-javaee-7.0-with-all</artifactId>
         <version>8.0.0.Final</version>
         <scope>import</scope>
      </dependency>
   </dependencies>
</dependencyManagement>

Then within your library dependencies, you won’t need to declare which version you are going to use, as this information is picked up from the BOM:

<dependency>
   <groupId>org.jboss.spec.javax.ejb</groupId>
   <artifactId>jboss-ejb-api_3.2_spec</artifactId>
   <scope>provided</scope>
</dependency>

References:

The above article is an excerpt from the upcoming book, Java EE 7 development on WildFly application server published by ItBuzzPress.