# Codehaus Cargo : Existing Local Configuration

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

### Definition

Re-use an existing container installation

### Explanations

An existing configuration plugs itself onto an existing container installation that exists on your hard disk. This is by opposition to the Standalone Local Configuration which creates a new container installation from scratch in a directory of your choice. Existing configurations require that the user creates a valid configuration directory and points Cargo to it.

Whenever you configure or start a container which uses an existing configuration, Cargo will:

- Copy all configuration files
- Perform a local deployment of all deployables

As a result, Cargo will not be configuring the configuration properties nor the data sources and resources on your container; these need to be configured beforehand.

Please note that this method does not guarantee reproducibility, as the configuration is not "cleaned" at any point. If you want to keep a generated configuration you can ask Cargo to generate a standalone configuration once and then consider it an existing configuration.

### Support Matrix

Java | Ant | Maven 3
--- | --- | ---

### Java API

There are different ways of using an existing configuration:

- By directly instantiating the configuration matching your container. For example:

    [...]
    Configuration configuration = new ResinExistingLocalConfiguration("target/resin3x");
    [...]

- By using the `DefaultConfigurationFactory` which automatically maps the right implementation for the container you're using. For example:

    [...]
    ConfigurationFactory factory = new DefaultConfigurationFactory();
    Configuration configuration = factory.createConfiguration("resin3x",
        ContainerType.INSTALLED, ConfigurationFactory.EXISTING, "c:/apps/resin-3.0.9");
    [...]

### Ant Task

Example:

    <cargo containerId="resin3x" [...]>
      <configuration type="existing" home="c:/apps/resin-3.0.9"/>
      [...]
    </cargo>

### Maven 3 Plugin

    [...]
    <container>
      <containerId>resin3x</containerId>
      [...]
    </container>
    <configuration>
      <type>existing</type>
      <home>c:/apps/resin-3.0.9</home>
    </configuration>
    [...]