Maven Cargo Tomcat

From Foochal

Jump to: navigation, search

Configuring cargo to hot-deploy the application to a remote (and running) tomcat

          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <container>
                <containerId>tomcat5x</containerId>
                <type>remote</type>
              </container>

              <configuration>
                <type>runtime</type>
                <properties>
                  <cargo.remote.username>tomcat admin user name</cargo.remote.username>
                  <cargo.remote.password>tomcat admin password</cargo.remote.password>
                </properties>
              </configuration>

              <deployer>
                <type>remote</type>
                <deployables>
                  <deployable>
                    <properties>
                      <context>/${cargo.context}</context>
                    </properties>
                  </deployable>
                </deployables>
              </deployer>
            </configuration>
          </plugin>

Other cargo properties are listed here: http://cargo.codehaus.org/Configuration+properties

You can either specify the properties right in the pom.xml. However, the best practice is to put local environment specific settings in your local settings.xml. Here's an example.

vi ~/.m2/settings.xml
<settings 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/xsd/settings-1.0.0.xsd">
  <profiles>
    <profile>
      <id>selenium</id>
      <properties>
        <cargo.remote.username>XXX</cargo.remote.username>
        <cargo.remote.password>XXX</cargo.remote.password>
      </properties>
    </profile>
  </profiles>
</settings>

Personal tools