Deploy to Tomcat 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 Tomcat (for example), add the following to your pom.xml:


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:


I need to investigate whether or not Cargo will allow hot deploy to Tomcat.

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

Leave a Reply