Deploying a Web Application from Maven Build to Remote Tomcat Container with Cargo

Several days ago I had to implement a mechanism that uploads a web application to the running instance of Tomcat. The web application was build using Maven, so the obvious choice was Maven Cargo plugin. The Cargo framework is mostly intended for integration testing, but it’s Maven plugin can do some useful things by the way, as a side effect. There are a lot of documentation on the web about Cargo in general and remote deployment to Tomcat specifically, but I was unable to find the complete example to be taken as-is. So, here it goes!

* Your Maven project should be of type war.
* The manager user must have script access to Tomcat Manager application.

Here is the excerpt from the POM file of the project, for future reference.


        <!-- Container configuration -->

        <!-- Configuration to use with the container -->

        <!-- Deployer configuration -->

        <!-- Deployables configuration -->


After adding this configuration to your project you will be able to deploy your web application to the remote Tomcat by running the following command line:

mvn cargo:redeploy


2 thoughts on “Deploying a Web Application from Maven Build to Remote Tomcat Container with Cargo

    1. 1. In my case Tomcat listens to HTTP, which is the default. For HTTPS, just add <cargo.protocol>https</cargo.protocol> property to the runtime configuration.
      2. Can you provide more details on that, please?

Leave a Reply

Your email address will not be published. Required fields are marked *