How to use WildFly BOMs in your applications

To keep versions of your WildFly API in sync with a Jakarta EE version you can use WildFly Bill of Materials. The WildFly BOMs project therefore allows you to easily use your stack of choice.

UPDATE: 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.

WildFly Jakarta EE BOM

In order to build and deploy Jakarta EE 10 applications running on WildFly 27 or newer we recommend including the following Bill of Materials in your pom.xml:

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

Replace the property version.server.bom with your WildFly version.

On the other hand, if you are deploying applications for WildFly 18 up to WildFly 26 we recommend adding 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>

Next, specify wildfly.version using a property. Please note the latest version of WildFly is 31.0.1.Final

By including the above BOM, you will not need 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>

If you do specify a version for the artifact, it will override the one which is in the Bill Of Material.

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

WildFly BOMs vs Jakarta EE API

By using WildFly tools Bill Of Materials you will be able to build easily applications which require JBoss tools like Arquillian. On the other hand, if you are using pure and simple Jakarta EE API in your project, the simplest option is to add just the single jakarta.jakartaee-api dependency. This is an umbrella dependency that includes all the Jakarta EE dependency in one shot:

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

When using the jakarta.jakartaee-api you are essentially 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, to build, test or debug 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, to build, test or debug 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, to build, test or debug SOAP Web Services 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 for WildFly 8 and 9
  • BOMS for 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.

Found the article helpful? if so please follow us on Socials