Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Definition

Excerpt

Deploy a WAR that will be started when the container starts

Example

Let's see how to use Jetty 4.x (an embedded container) with a WAR to deploy in it.

Code Block
LocalContainer container = new Jetty4xEmbeddedLocalContainer(
    new JettyStandaloneConfiguration("target/jetty4x"));

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

container.start();

Example using the Ant API

Starting JOnAS 5.x with a WAR to deploy:

Code Block
xml
xml
<cargo containerId="jonas5x" home="c:/jonas/jonas-5.1.2" action="start">
  <configuration>
    <deployable type="war" file="path/to/simple-war.war">
      <property name="context" value="application-context"/>
    </deployable>
  </configuration>
</cargo>

Example using the Maven2/Maven3 API

Here is the plugin configuration defining a JOnAS 5.x container with a WAR to deploy:

Code Block
xml
xml
<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>jonas5x</containerId>
      <artifactInstaller>
        <groupId>org.ow2.jonas.assemblies.profiles</groupId>
        <artifactId>jonas-full</artifactId>
        <version>5.2.1</version>
        <classifier>bin</classifier>
      </artifactInstaller>
      <deployables>
        <deployable>
          <groupId>org.codehaus.cargo</groupId>
          <artifactId>simple-war</artifactId>
          <type>war</type>
          <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: