Using Cargo with Maven to Remotely Deploy a WAR Without Using HOT

We use Cargo with Maven on the build server to remotely deploy the WAR file from our build server to the internal QA server for testing.

Our current POM for the project is shown below and works correctly for quick deployment.

The problem is that instead of a hot deployment, we would like the Cargo plugin to stop the Tomcat instance, deploy the new WAR, and start Tomcat. Is there a way to change the POM to manage this scenario?

Our Maven build is defined as:

mvn clean deploy ... cargo:redeploy 

And the boot plugin settings in POM:

  <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <configuration> <container> <containerId>tomcat7x</containerId> <type>remote</type> <systemProperties> <cargo.jvmargs>-XX:MaxPermSize=256M -Xmx1024m</cargo.jvmargs> </systemProperties> </container> <configuration> <type>runtime</type> <properties> <cargo.hostname>qa-server</cargo.hostname> <cargo.servlet.port>8080</cargo.servlet.port> <cargo.tomcat.manager.url>http://qa-server:8080/manager</cargo.tomcat.manager.url> <cargo.remote.username>username</cargo.remote.username> <cargo.remote.password>pass</cargo.remote.password> </properties> </configuration> <deployer> <type>remote</type> <deployables> <deployable> <groupId>com.ourcompany</groupId> <artifactId>myapp-artifactId</artifactId> <type>war</type> <properties> <context>latest</context> </properties> </deployable> </deployables> </deployer> </configuration> </plugin> 
+4
source share
2 answers

We had difficulties with Cargo. After some time, tomcat gets stuck and will not reboot. The load does not allow to start / stop tomcat.

So, in the end, we abandoned the load and used the script to restart tomcat at a distance from our jenkins machine. We also share a folder on the integration computer used to deploy our wars. We also use the maven build plugin for our conf files and folders.

+4
source

How to make a cleanTomcat ant task call inside the build.xml file and execute the following thread:

 #1. stop, clean container, start mvn cargo:stop antrun:run <<<<<<< build.xml file to clean +war +warUnpacked +context.xml cargo:start #2. deploy your webapp mvn cargo:deploy 

About previous answer unludo , sharing folders between servers is a good way to increase speed for the deployment phase.

You can use maven-clean-plugin (yes, one of mvn clean, but with additional configuration) also to clean directories outside your java project i.e. delete what you need to delete in the tomcat container.

0
source

Source: https://habr.com/ru/post/1401829/


All Articles