Chapter 3. Provisioning a server by using the JBoss EAP Maven plug-in


You can provision a server by using the JBoss EAP Maven plug-in both for bare metal and OpenShift Container Platform.

Traditionally, you would install JBoss EAP using one of the installation methods such as using the installation manager and then deploy applications to the server. Instead of having to first install the server, you can simply provision a server when you build your application with the application deployed to the provisioned server.

Prerequisites

Procedure

  1. Define the following property in the pom.xml configuration file:

    <properties>
        ...
        <version.plugin.eap>2.0.0.Final-redhat-00009</version.plugin.eap> 
    1
    
    </properties>
    1
    <version.plugin.eap> is provided as an example. See the Red Hat Maven repository for more information on JBoss EAP Maven plugin releases: org/jboss/eap/plugins/eap-maven-plugin/. For JBoss EAP 8.1, the latest major 2.x version is required.
  2. Add the JBoss EAP maven plugin to <pluginManagement>, in <build> section inside the <project> section.

    <project>
    ...
        <build>
            <pluginManagement>
                <plugins>
                    ...
                    <plugin>
                        <groupId>org.jboss.eap.plugins</groupId>
                        <artifactId>eap-maven-plugin</artifactId>
                        <version>${version.plugin.eap}</version>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
    </project>
  3. Add the eap-maven-plugin in the pom.xml configuration file. In the following examples, the plug-in is included within different profiles provisioned-server and bootable-jar.

    • Create a profile for server provisioning.

      <project>
          ...
          <profiles>
              ...
              <profile>
                  <id>provisioned-server</id>
                  <activation>
                      <activeByDefault>true</activeByDefault>                
      1
      
                  </activation>
                  <build>
                      <plugins>
                          <plugin>
                              <groupId>org.jboss.eap.plugins</groupId>
                              <artifactId>eap-maven-plugin</artifactId>
                              <configuration>
                                <channels>                                   
      2
      
                                   <channel>
                                       <manifest>
                                           <groupId>org.jboss.eap.channels</groupId>
                                           <artifactId>eap-8.1</artifactId>
                                       </manifest>
                                   </channel>
                                </channels>
                                <feature-packs>
                                   <feature-pack>                            
      3
      
                                       <location>org.jboss.eap:wildfly-ee-galleon-pack</location>
                                   </feature-pack>
                                </feature-packs>
                                <layers>                                      
      4
      
                                   <layer>datasources-web-server</layer>
                                </layers>
                              </configuration>
                              <executions>
                                  <execution>
                                      <goals>
                                          <goal>package</goal>              
      5
      
                                      </goals>
                                  </execution>
                              </executions>
                          </plugin>
                      </plugins>
                  </build>
              </profile>
          </profiles>
      </project>
      1
      Set activeByDefault to true to activate this profile by default.
      2
      Define the channels from which the feature-packs are to be fetched.
      3
      Define the feature-packs that should be used. In this example, org.jboss.eap:wildfly-ee-galleon-pack feature-pack is used. For information about the layers that this feature-pack includes, see wildfly-ee-galleon-pack layers.
      4
      Define the layers from the configured feature-packs to include in the provisioned server. This example uses datasources-web-server. For information about datasources-web-server, see datasources-web-server.
      5
      Define the goal for provisioning the server. This example uses the package goal which provisions the server with the application packaged. To provision a server without the application packaged, use the provision goal.
    • Create a profile for bootable JAR.

      <project>
          ...
          <profiles>
              ...
              <profile>
                  <id>bootable-jar</id>
                  <activation>
                      <activeByDefault>true</activeByDefault>                
      1
      
                  </activation>
                  <build>
                      <plugins>
                          <plugin>
                              <groupId>org.jboss.eap.plugins</groupId>
                              <artifactId>eap-maven-plugin</artifactId>
                              <configuration>
                                <channels>                                   
      2
      
                                   <channel>
                                       <manifest>
                                           <groupId>org.jboss.eap.channels</groupId>
                                           <artifactId>eap-8.1</artifactId>
                                       </manifest>
                                   </channel>
                                </channels>
                                <feature-packs>
                                   <feature-pack>                            
      3
      
                                       <location>org.jboss.eap:wildfly-ee-galleon-pack</location>
                                   </feature-pack>
                                </feature-packs>
                                <layers>                                      
      4
      
                                   <layer>datasources-web-server</layer>
                                </layers>
                                <bootable-jar>true</bootable-jar>         
      5
      
                              </configuration>
                              <executions>
                                  <execution>
                                      <goals>
                                          <goal>package</goal>              
      6
      
                                      </goals>
                                  </execution>
                              </executions>
                          </plugin>
                      </plugins>
                  </build>
              </profile>
          </profiles>
      </project>
      1
      Set activeByDefault to true to activate this profile by default.
      2
      Define the channels from which the feature-packs are to be fetched.
      3
      Define the feature-packs that should be used. In this example, org.jboss.eap:wildfly-ee-galleon-pack is used. For information about the layers that this feature-pack includes, see wildfly-ee-galleon-pack layers.
      4
      Define the layers to provision the server with. This example uses datasources-web-server. For information about datasources-web-server, see datasources-web-server
      5
      Provision the server as a bootable JAR.
      6
      Define the goal for provisioning the server. This example uses the package goal which provisions the server with the application packaged. To provision a server without the application packaged, set skipDeployment to true.
      Note

      You cannot use the provision goal when you set the value of the bootable-jar attribute to true.

  4. If your Maven project does not contain an application, create the application as usual, for example, see Creating a hello world servlet.
  5. Provision the server by building the application.

    $ mvn package
    Note

    If you use the mvn package command with debugging enabled (-X option), include the property -Dorg.slf4j.simpleLogger.log.com.networknt.schema=off to prevent excessive debug logging during schema validation.

Verification

  • Start the application.

    • To start the application with the provisioned server, use the following commands:

      1. Navigate to the directory containing the provisioned server.

        $ cd target/server/standalone/bin
      2. Start the server.

        $ ./standalone.sh
    • To start the application as bootable JAR, use the java -jar command:

      java -jar target/<application-name>.jar

Provision a server for OpenShift Container Platform that only includes the required capabilities by using the JBoss EAP Maven plug-in.

Prerequisites

Procedure

  1. Define the following property in the pom.xml configuration file:

    <properties>
        ...
        <version.plugin.eap>2.0.0.Final-redhat-00009</version.plugin.eap> 
    1
    
    </properties>
    1
    <version.plugin.eap> is provided as an example. See the Red Hat Maven repository for more information on JBoss EAP Maven plugin releases: org/jboss/eap/plugins/eap-maven-plugin/. For JBoss EAP 8.1, the latest major 2.x version is required.
  2. Add the JBoss EAP maven plugin to <pluginManagement>, in <build> section inside the <project> section.

    <project>
    ...
        <build>
            <pluginManagement>
                <plugins>
                    ...
                    <plugin>
                        <groupId>org.jboss.eap.plugins</groupId>
                        <artifactId>eap-maven-plugin</artifactId>
                        <version>${version.plugin.eap}</version>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
    </project>
  3. Add the eap-maven-plugin in the pom.xml configuration file. In the following examples, the plug-in is included within the OpenShift Container Platform profile.

    <profiles>
        <profile>
            <id>openshift</id>
            <build>
                <plugins>
                    <plugin>
                         <groupId>org.jboss.eap.plugins</groupId>
                         <artifactId>eap-maven-plugin</artifactId>     
    1
    
                         <configuration>
                             <channels>
                                 <channel>
                                     <manifest>
                                         <groupId>org.jboss.eap.channels</groupId>
                                         <artifactId>eap-8.1</artifactId>
                                     </manifest>
                                 </channel>
                             </channels>
                             <feature-packs>
                                 <feature-pack>                            
    2
    
                                     <location>org.jboss.eap:wildfly-ee-galleon-pack</location>
                                 </feature-pack>
                                 <feature-pack>
                                     <location>org.jboss.eap.cloud:eap-cloud-galleon-pack</location>
                                 </feature-pack>
                             </feature-packs>
                             <layers>                                      
    3
    
                                 <layer>cloud-server</layer>
                             </layers>
                         </configuration>
                         <executions>
                             <execution>
                                 <goals>
                                     <goal>package</goal>
                                 </goals>
                             </execution>
                         </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    1
    eap-maven-plugin is a JBoss EAP plug-in.
    2
    Define the feature-packs that should be used. In this example, org.jboss.eap:wildfly-ee-galleon-pack feature-pack is used. For information about the layers that this feature-pack includes, see wildfly-ee-galleon-pack layers. The org.wildfly.cloud:wildfly-cloud-galleon-pack feature-pack is required for OpenShift.
    3
    Define the layers from the configured feature-packs to include in the provisioned server. This example uses the cloud-server layer, which provisions just the basic features of JBoss EAP, for OpenShift. For information about the cloud-server layer, see cloud-server.
    <name>ROOT.war</name>: Defines the resulting name of the application’s web archive (WAR). If ROOT.war is specified then the application is deployed at the root path of the server, otherwise it is deployed at <name/> relative path.
    Important

    Bootable jar is not supported on OpenShift Container Platform.

  4. If your Maven project does not contain an application, create the application as usual, for example, see Creating a hello world servlet.
  5. Provision the server by building the application.

    $ mvn package
    Note

    If you use the mvn package command with debugging enabled (-X option), include the property -Dorg.slf4j.simpleLogger.log.com.networknt.schema=off to prevent excessive debug logging during schema validation.

Verification

  • You can check the generated server configuration file target/server/standalone/configuration/standalone.xml that contains the provisioned subsystems and application deployment.

The JBoss EAP server that contains your deployment has been provisioned.

Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top