Definition
Deploy an expanded WAR that will be started when the container startsExample 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 API
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 Maven2/Maven3 API
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-maven2-plugin</artifactId>
<version>${cargo.version}</version>
<configuration>
<containerId>tomcat7x</containerId>
<zipUrlInstaller>
<url>http://repo1.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:
- How deployables work, which explains how to instanciate and personalize deployables.
- How deployers work, which explains how the different deployers work.