Definition

Deploy a WAR that will be started when the container starts

Example using the Java API

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

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 tasks

Starting JOnAS 5.x with a WAR to deploy:

<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 Maven 3 plugin

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

<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>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 Codehaus Cargo works, please read:

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