Select Page

Apache Maven Cargo deploy with Tomcat 7

Apache Maven Cargo deploy with Tomcat 7

Following the post about Deploy to Tomcat 6 using #Maven, here is a ready to use example with the main differences explained in the table below

 Tomcat 7Tomcat 6
Url of Tomcat manager<cargo.remote.uri><cargo.tomcat.manager.url>

<role rolename=”manager-gui”/>
<role rolename=”manager-script”/>
<role rolename=”manager-jmx”/>
<role rolename=”manager-status”/>
<user username=”admin” password=”admin” roles=”manager-gui,manager-script”/>

  <role rolename=”manager”/>
  <user username=”admin” password=”admin” roles=”manager”/>

And finally a snippet of an Apache #Maven pom.xml ready to use in a profile, so you can reuse this profile like a method call


Place as many profiles as you have machine to deploy in settings.xml and declare some variables as properties, as shown below:

        <!-- these properties must be defined as system property or -D --> 
        <!-- - deployable.artifactid: artifactId of web application to be deployed --> 
        <!-- - deployable.context: web context name -->

So you can run, and target multiple host by just exchanging the name of the profile serverA to something else.

mvn integration-test –PdeployTomcat,serverA –Ddeployable.artifactid=demo -Ddeploy.groupid=com.mycompany –Ddeployable.context=showcase

About The Author

Cédric Walter

I worked with various Insurances companies across Switzerland on online applications handling billion premium volumes. I love to continuously spark my creativity in many different and challenging open-source projects fueled by my great passion for innovation and blockchain technology.In my technical role as a senior software engineer and Blockchain consultant, I help to define and implement innovative solutions in the scope of both blockchain and traditional products, solutions, and services. I can support the full spectrum of software development activities, starting from analyzing ideas and business cases and up to the production deployment of the solutions.I'm the Founder and CEO of Disruptr GmbH.