
Leading the Way: Payara Platform Community 7 Beta Now Fully Jakarta EE 11 Certified
We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]
When creating a Java EE application it is important to deploy and test it on a server that is as close to the target production environment as possible. If you use Maven in your project, it is possible to do so using the Cargo plugin, which allows you to deploy an application to an instance of Payara Server either locally or remotely. A complete example is available at https://github.com/payara/Payara-Examples/blob/master/ecosystem/payara-maven/pom.xml.
The cargo plugin can be added to a Maven project by adding the following to the <plugins>
section of the pom:
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.7.16</version> <executions> ... </executions> </plugin>
There are four common goals you may use in your execution:
start
runs goal start to start a local Payara server in background (not possible with remote deployment type)
redeploy
runs goal redeploy to deploy the built application (will undeploy if needed)
undeploy
runs goal undeploy to undeploy the built application
stop
runs goal stop to stop the server running in background (not possible with remote deployment type)
An example of how you might use those goals to run an integration test:
<execution> <id>deploy</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal <goal>redeploy</goal> </goals> </execution> <execution> <id>undeploy</id> <phase>post-integration-test</phase> <goals> <goal>undeploy</goal> <goal>stop</goal> </goals> </execution>
To deploy to a remote instance of Payara Server add the following configuration to the profile you are using:
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <configuration> <container> <containerId>payara</containerId> <type>remote</type> </container> <configuration> <type>runtime</type> <properties> <username>admin</payara.username> <password></payara.password> <hostname>localhost</payara.hostname> <cargo.remote.username>${username}</cargo.remote.username> <cargo.remote.password>${password}</cargo.remote.password> <cargo.glassfish.admin.port>4848</cargo.glassfish.admin.port> <cargo.hostname>${hostname}</cargo.hostname> </properties> </configuration> </configuration> <!-- provides JSR88 client API to deploy on Payara Server --> <dependencies> <dependency> <groupId>org.glassfish.main.deployment</groupId> <artifactId>deployment-client</artifactId> <version>5.0</version> </dependency> </dependencies> </plugin>
A few important points to note about this configuration:
start
and stop
execution goals cannot be used with a remote Payara Server instance; this means that the remote instance MUST be running, otherwise Maven will fail.To deploy to a local instance of Payara Server add the following to the profile you are using:
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <configuration> <container> <containerId>payara</containerId> <type>installed</type> <home>${payara.home}</home> </container> <configuration> <type>existing</type> <home>${payara.domainDir}</home> <properties> <cargo.glassfish.domain.name>${payara.domainName}</cargo.glassfish.domain.name> </properties> </configuration> </configuration> <!-- provides JSR88 client API to deploy on Payara --> <dependencies> <dependency> <groupId>org.glassfish.main.deployment</groupId> <artifactId>deployment-client</artifactId> <version>5.0</version> </dependency> </dependencies> </plugin>
The full path to the Payara Server home, domains directory and domain name must be specified i.e.
payara.home=/path/to/payara5
payara.domainDir=/path/to/payara5/glassfish/domains
payara.domainName=domain1
Further information about the plugin is available at https://codehaus-cargo.github.io/cargo/Payara.html.
We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]
Managing Payara Server Just Got Smarter Imagine managing your Jakarta EE applications not just with Maven goals, but by […]
Welcome aboard the August 2025 issue of The Payara Monthly Catch! With summer in full swing, things may have felt […]
github link broken
https://github.com/payara/Payara-Examples/blob/master/ecosystem/payara-maven/pom.xml
Many thanks, fixed now.
Please review your samples more carefully. Please also assume that your reader has never used cargo in a maven project.
Errors in tags:
admin
localhost
You neglected to discuss the password.properties file when using a local server that, had you changed the admin password in Payara, still contains the original install password.
You must also add cargo:deploy to your default goals. I like to avoid command line parameters favouring placing everything in the pom.xml that I can. This is especially important when using an IDE like NetBeans, etc.
This doesn’t seem work on JDK 11. Any ideas on that?
Cheers, Joni
Have you tired the latest version of the cargo plugin (1.7.12)?
Still not working, with cargo-maven3-plugin version 1.9.3, nor cargo-maven2-plugin version 1.7.12. Get ClassNotFoundException: javax/xml/bind/DatatypeConverter.
Hello,
With Maven, is it possible to copy by SFTP my WAR file to Payara’s autodeploy folder instead of deploying it directly in Payara-Server? (some cases of use in my company require me to go through this autodeploy folder)
Thank you very much
Thierry
Failed to execute goal org.codehaus.cargo:cargo-maven3-plugin:1.9.8:redeploy (default) on project cbs: Execution default of goal org.codehaus.cargo:cargo-maven3-plugin:1.9.8:redeploy failed: error submitting remote command: org.glassfish.api.admin.CommandException: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake: SSL peer shut down incorrectly -> [Help 1]
Joni, as explained on https://codehaus-cargo.github.io/cargo/JSR88.html the SSLHandshakeException happens because unfortunately even the latest version of the GlassFish Deployment Client dependency uses TLS version 1, and offers to ways to change it.
Later versions of the Payara deployment client fix this issue by setting the default to a modern TLS version:
– You can reference the proper version of the following (unfortunately, very large) artifact: https://repo.maven.apache.org/maven2/fish/payara/extras/payara-embedded-web/ instead of the org.glassfish.main.deployment:deployment-client
– These newer versions also support a fish.payara.clientHttpsProtocol system variable you can set on the Java VM, enabling the choice between different TLS versions if needed