Skip to content

Instantly share code, notes, and snippets.

@mdread
Last active January 12, 2023 15:55
Show Gist options
  • Save mdread/5900034 to your computer and use it in GitHub Desktop.
Save mdread/5900034 to your computer and use it in GitHub Desktop.
maven configuration for remote deploying on tomcat with cargo
TODO: add notes on configuration
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<groupId>my.company</groupId>
<artifactId>my-artifact</artifactId>
<name>project-name</name>
<packaging>war</packaging>
<version>1.0.0-BUILD-SNAPSHOT</version>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat7x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.hostname>${cargo.hostname}</cargo.hostname>
<cargo.servlet.port>${cargo.servlet.port}</cargo.servlet.port>
<cargo.tomcat.manager.url>${cargo.tomcat.manager.url}</cargo.tomcat.manager.url>
<cargo.remote.username>${cargo.remote.username}</cargo.remote.username>
<cargo.remote.password>${cargo.remote.password}</cargo.remote.password>
</properties>
</configuration>
<deployer>
<type>remote</type>
</deployer>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>${project.packaging}</type>
</deployable>
</deployables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>env-prod</id>
<properties>
<deploy.env>prod</deploy.env>
<cargo.hostname>my-production-host</cargo.hostname>
<cargo.servlet.port>9090</cargo.servlet.port>
<cargo.tomcat.manager.url>http://my-production-host:9090/manager</cargo.tomcat.manager.url>
<cargo.remote.username>user</cargo.remote.username>
<cargo.remote.password>pass</cargo.remote.password>
</properties>
</profile>
<profile>
<id>env-dev</id>
<properties>
<deploy.env>dev</deploy.env>
<cargo.hostname>my-dev-host</cargo.hostname>
<cargo.servlet.port>9090</cargo.servlet.port>
<cargo.tomcat.manager.url>http://my-dev-host:9090/manager</cargo.tomcat.manager.url>
<cargo.remote.username>user</cargo.remote.username>
<cargo.remote.password>pass</cargo.remote.password>
</properties>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment