# Codehaus Cargo : Static deployment of EAR

Created by Former user, last modified by S. Ali Tokmen on Jan 28, 2021

### Definition

Deploy an EAR that will be started when the container starts

### Example using the Java API

Starting JOnAS 5.x with an EAR to deploy:

    InstalledLocalContainer container = new Jonas5xInstalledLocalContainer(
        new OrionStandaloneConfiguration("target/jonas5x"));
    container.setHome("c:/apps/jonas-full-5.2.1");

    Deployable ear = new EAR("src/data/some.ear");
    container.getConfiguration().addDeployable(ear);

    container.start();

### Example using the Ant tasks

Starting JOnAS 5.x with an EAR to deploy:

    <cargo containerId="jonas5x" home="c:/apps/jonas-full-5.2.1" action="start">
      <configuration>
        <deployable type="ear" file="src/data/some.ear"/>
      </configuration>
    </cargo>

### Example using the Maven 3 plugin

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

    <dependencies>
      <dependency>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>simple-ear</artifactId>
        <version>${simple-ear.version}</version>
        <type>ear</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-ear</artifactId>
              <type>ear</type>
            </deployable>
          </deployables>
        </configuration>
      </plugin>
    </plugins>

### For more information...

For more information about how deployment in Codehaus 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.