Cargo "is a thin wrapper that allows you to manipulate various types of application containers (Java EE and others) in a standard way."
Within Magnolia projects there is often an existing integration of Tomcat 6 or 7 in the Maven webapp configuration using the Tomcat Maven Plugin so that Magnolia can be started on the command line.
Using a more recent Tomcat version
Because Tomcat 7 is already quite dated now and often newer Tomcat versions are required, this article quickly shows you how to add the needed configuration using Cargo which is a replacement for the Tomcat Maven Plugin.
Maven plugin configuration
See the the cargo configuration for Tomcat 8.5.4 added to a (very) basic Magnolia webapp configuration file (pom.xml):
You can start the server from within your webapp directory using the Maven command
- In a "real" project you would replace concrete versions with variable names and wrap maven settings and execution in one ore more shell scripts.
- I already added JVM arguments to the cargo.jvmargs parameter suitable for Magnolia projects (adjust them to your needs, especially the memory settings).
- The JVM arguments already contain parameters for remote debugging (port 5005).
- The context your web application is running under was already set (in this example to /dev). This is needed by some applications so they know which configuration to load.
- The (commented out) timeout parameter is very important if your application needs some time for (initial) startup. If starting can take quite some time for your application then the default timeout setting for Cargo might prevent a successful deployment.
- Consider setting magnolia.update.auto=false in your magnolia.properties file so that the initial deployment with Cargo doesn't take too long.
Convenient SSL configuration for development
In the next post I will show you how you can extend the Cargo configuration to add Java Keystore / certificate configuration on the fly for deployments needing the HTTPS protocol for development and testing.