News Ticker

Maven Cargo Plugin: WildFly 10.x


The Maven Cargo plugin allows you to manipulate various containers from your application’s POM.

Start your free trial on and Learn Java EE with my new course.

Container support is available for the following servers:

  • Geronimo, Glassfish
  • JBoss, Jetty, Jo!, JOnAS, JRun
  • Orion/OC4J
  • Resin
  • Tomcat, TomEE
  • WebLogic, WebSphere and WildFly.

Cargo supports two running modes standalone and runtime. Runtime mode assumes that a server is already installed and launched while in standalone mode the server zip file is downloaded and installed.

Automate Wildfly deployment with Maven Cargo Plugin. Tweet this!

In this article, I will look at how to configure the Maven Cargo plugin for Wildfly 10.x in standalone mode and show how to setup an application and management user.

Getting Started

I am going to define the Cargo build within a profile. The version of Cargo I am going to use is 1.6.1 and its location is:


and the latest version can be found on Maven central: cargo-maven2-plugin.

Configure Cargo

I am going to configure Cargo to download and install Wildfly 10.1.0 and set up an application and management user with the username adminUser and password admin123!.

Add Cargo Plugin to Profile

Within a profile, add the Cargo group and artifact id, as follows.

                        <!-- Here we configure the container
                             and server properties -->   

Within the plugin tags, I will define the container and the server configurations.

Add Container Configurations

The container that we want to install is defined between <containerId> tags. In this example, we want to install WildFly 10, so the container id that we will use is wildfly10x. A full list of supported containers and version can be found on the Cargo home page.

By default the container mode is standalone, so I need to specify a location from which to download the server zip file. This zip file is the same file that you would have downloaded from the website if you wanted to install it manually.


Further configurations are possible. Visit the Maven2 Plugin Reference Guide for full details.

Add Server Properties

Now I will add the server properties. I am going to specify the hostname, the management port and the username and password to set for the application and management users.

The configuration of the hostname and management port are self-explanatory. The username and password are specified in the format USERNAME:PASSWORD.


Further configurations are possible. Visit the Configuration Properties for full details.

Execute Maven Command

The command that executes the application deployment and installation of the server is mvn package cargo:run.

Further targets can be found on the Maven2 Plugin page.

The Full POM

I have committed the POM that uses the cargo plugin to my Maven Solutions Github Repository.

Other Related Articles

Support for HTTP/2 will be available in Java EE 8 and Java 9 this is one of the most significant additions in the next release. Read my article Configure Tomcat 9 for HTTP/2 where I show how to add support for HTTP/2 and how to configure TLS.

Before Maven there was Apache Ant. With this tool, you can automate the compilation of your project, its deployment and the launch of Tomcat server. Find out how to do all this with a simple Ant script in my article: Compile, deploy and start Tomcat with Ant script.

Tomcat uses the configuration files server.xml to configure important things. I wrote about an example of how to use this file in my post: Tomcat server.xml example.

Have you read my book: Professional Java EE Design Patterns? Is so pop over to the dedicated book forum and discuss it.