Deploy to JBoss using Cargo

The Cargo plugin for Maven has the following uses:

  • to start containers for integration and functional tests
  • to start containers for applications that require a container to be started (Plugins for IDEs, etc)
  • as a framework to manipulate J2EE Module file including container-specific descriptors.
  • to generate container configurations for deployment.

One of the nice things about Cargo is that it can be used to download a container, so that manual installation is not necessary. To configure Cargo to download JBoss (for example), add the following to your pom.xml (under <build><plugins>, not <build><pluginManagement>):


You can then run the command

mvn package deploy cargo:start

to fire up the container with your packaged code. It will take a while the first time this is run, as it has to download the zip file from the URL.

mvn cargo:stop

will stop the container.

If you want to use Cargo to start prior to running integration tests, and to stop afterwards, add the following:


The Cargo JBoss container also allows for hot deploy. This can be done by simply running the command

mvn package cargo:deploy

while the container is started.

Tip: when combined with How to Skip the Maven ‘test’ Phase, the hot deploy takes a lot less time than running ‘mvn package deploy’ and starting the container manually.

It's only fair to share...
Share on Facebook
Tweet about this on Twitter
Share on LinkedIn

Leave a Reply