Deploying to Payara Deployment Group Using the Maven Cargo Plugin

Photo of Rudy De Busscher by Rudy De Busscher


The Apache Maven Cargo Plugin allows you to deploy your application to a Payara Server, running locally or remotely. Using Maven as a build tool is an easy way to immediately deploy the application during the build to a test or production server.

We have created a custom version of the Cargo Plugin which also supports the Deployment Group feature of the Payara Server.

You can read how to use the plugin in the Deploying to Payara Server using the Cargo Plugin blog in more detail.

The Deployment Group is the clustering technique within Payara Server to have your application running on multiple instances so user requests can be divided over multiple machines and thus increases the number of user requests that can be handled by your environment.

We have created a custom version of the Cargo Plugin which also supports the Deployment Group feature of the Payara Server.

Cargo Plugin

The Cargo plugin supports the JSR-88 specification of Java EE which means it can deploy and undeploy any application to a compliant server. Payara Server also supports this specification and as you can read in the blog it allows you to interact directly with Payara Server using the Cargo plugin.

The Deployment Group functionality in Payara Server is not a standard functionality of Java EE or Jakarta EE. This means that you can experience some issues when specifying a Deployment Group as the target in the Cargo Plugin.  For example, when you ask for a redeploy to the local-group, you get the message:

[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.7.7:redeploy (default-cli) on project demo:
Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.7.7:redeploy failed:
Cannot communicate with the server: Error getting required modules: remote command execution failed on the server: Target local-group is not a supported type.
Command _list-app-refs supports these types of targets only: Stand alone instance, Config, Cluster, Default server,

Custom Version of the Cargo Plugin

To overcome the issues described above, we have created a custom version of the Cargo Plugin that correctly supports the Deployment Group functionality of the Payara Server. Here are the steps to use it:

1. Add the Payara Patched Projects as Plugin repository to the Maven POM file.

<id>Payara Patched projects</id>

2. Define the customer version of the plugin.


The 1.8.4.payara-p1 version, only available within our repository on GitHub, has the capabilities to handle the Deployment Groups of the Payara Server correctly.

3. Use the configuration as before.

We did not make any change to the configuration, you can just use the Deployment Group name as the target property name.


Deploy Applications to Payara Server Deployment Group with Maven

Using the Maven Cargo Plugin is an alternative to deploy your applications to the Payara Server in situations you do not have the Asadmin Command Line (Asadmin CLI) tool available. It is especially useful when you are using Maven as your build tool as it can be configured to be part of the build phases.

With the updated version we have created, you can also deploy to a Deployment Group and not only to the DAS server, instance, or a Cluster.