Definition

Deploy an expanded WAR that will be started when the container starts

Example using the Java API

InstalledLocalContainer container = new Resin3xInstalledLocalContainer(
    new Resin3xStandaloneConfiguration("target/resin3x"));
container.setHome("c:/apps/resin-3.0.27");

Deployable war = new WAR("some/expanded/war/directory");
war.setContext("application-context");
container.getConfiguration().addDeployable(war);

container.start();

Example using the Ant tasks

Starting Tomcat 7.x with a WAR to deploy:

<cargo containerId="tomcat7x" home="C:/Program Files/Apache/Apache Tomcat 7.0.68" action="start">
  <configuration home="C:/Tomcat/7.0.68_BASE">
    <deployable type="war" file="some/expanded/war/directory">
      <property name="context" value="application-context"/>
    </deployable>
  </configuration>
</cargo>

Example using the Maven 3 plugin

Here is the plugin configuration defining a Tomcat 7.x container with a WAR to deploy expanded:

<dependencies>
  <dependency>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>simple-war</artifactId>
    <version>${simple-war.version}</version>
    <type>war</type>
  </dependency>
</dependencies>

<plugins>
  <plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven3-plugin</artifactId>
    <version>${cargo.version}</version>
    <configuration>
      <containerId>tomcat7x</containerId>
      <zipUrlInstaller>
        <url>https://repo.maven.org/maven2/org/apache/tomcat/tomcat/7.0.68/tomcat-7.0.68.zip</url>
      </zipUrlInstaller>
      <deployables>
        <deployable>
          <groupId>org.codehaus.cargo</groupId>
          <artifactId>simple-war</artifactId>
          <type>war</type>
          <!--
            Override location to point to the exploded webapp.
            -->
          <location>some/expanded/war/directory</location>
          <properties>
            <context>application-context</context>
          </properties>
        </deployable>
      </deployables>
    </configuration>
  </plugin>
</plugins>

For more information...

For more information about how deployment in CARGO works, please read:

Copyright 2004-2024. All rights reserved unless otherwise noted.
Click here to read our privacy and cookie policy