# Codehaus Cargo : Building

Created by Former user, last modified by S. Ali Tokmen on May 29, 2026

# Prequisites

- Check out or download as a ZIP file the Codehaus Cargo source code from Github into a `CARGOHOME` directory (wherever you want on your machine).

- Install the JDK 11. If you really want to build with JDK 8 or with JDK 12 and above, read our chapter on building with older or newer versions of the JDK.

- Install Maven 3.6.3 or later.
  If you are using Maven 3.8.1 or newer, you might have some `ArtifactTransferException`s with the OW2 snapshot repository (which was defined as HTTP over a decade back). You can work around these using the instructions in the chapter ArtifactTransferException with Maven 3.8.1 onwards.

Verify your installation works by running the following command in a command prompt / terminal window: `mvn -version`

# Building

To build Codehaus Cargo:

- Go to `CARGOHOME` and run `mvn install`
  This will build the full Cargo project.

- If you wish to clean all build-generated files, `cd` to `CARGOHOME` and run `mvn clean`

First time build

The Codehaus Cargo build contains functional tests. Those tests are run on different containers. The first time you build Codehaus Cargo it will download those container distributions which will take some time (the containers are installed into `core/samples/java/installs`). If you want to tell Codehaus Cargo to run only on some specific container, see below.

### Selecting containers

The default list of containers to run on depends a property `cargo.containers` defined in `CARGOHOME/core/samples/pom.xml`. It can also be supplied at the command line by using profiles (`-P<containerId>`).

For example if you only want to run on Tomcat 8.x you'd run: `mvn -Ptomcat8x clean install`

### Proxy settings

If you need to build Codehaus Cargo from behind a proxy, proceed as follows:

- Edit the `.m2/settings.xml` file from your home directory (`C:\Documents and Settings\username` or `C:\Users\username` on Windows),

- Comment out the `<proxy>` element and fill in the proxy server settings accordingly.

### `ArtifactTransferException` with Maven 3.8.1 onwards

With Maven 3.8.1 onwards you might get errors such as:

##### Error when building with Maven 3.8.1 onwards

    org.eclipse.aether.transfer.ArtifactTransferException:
    Could not transfer artifact org.ow2.jonas.tools.configurator:api:pom:1.10.28-SNAPSHOT from/to maven-default-http-blocker (http://0.0.0.0/):
    Blocked mirror for repositories: [ow2-snapshot (http://repository.ow2.org/nexus/content/repositories/snapshots, default, snapshots)]

To work around the issue, create a `settings.xml` file in your `.m2` home which overrides the HTTP-based OW2 snapshots repository:

##### settings.xml sample

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          http://maven.apache.org/xsd/settings-1.0.0.xsd">
      <mirrors>
        <mirror>
          <id>ow2-snapshot-override</id>
          <name>ow2-snapshot-override</name>
          <url>https://repo.maven.apache.org/maven2</url>
          <mirrorOf>ow2-snapshot</mirrorOf>
        </mirror>
      </mirrors>
    </settings>

### Building with older or newer versions of the JDK

Codehaus Cargo has support for very old and very new containers, which implies it has quite a broad combination of Java source and target version requirements:

- Resin 3.x requires Java 6 (it cannot run with newer versions of Java), and since it is executed using a ResinRun class the whole Resin container must be compiled with Java 6

- In addition, as other containers such as JOnAS 5.x also require Java 6, all test samples need to be built using Java 6

- The Jetty Remote Deployer for Jetty 6.x as well as for Jetty 7.x to 9.x are built with Java 6, so we can support a broad range of Java versions on these Jetty containers

- At the same time, the Jetty Remote Deployers for Jetty 10.x and 11.x require the JDK 11 (because Jetty 10.x and 11.x require JDK 11 or above)

The only version of the JDK that can build with all these constraints is the JDK 11. We hence have certain modules of the Codehaus Cargo build that do not activate on JDK 8, and some others that don't activate on JDK 12 onwards. On these JDKs, you hence will get exceptions such as:

##### Error when building with JDK 8 or JDK 12 and above

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.11.0:copy (copy-test-ear) on project cargo-core-container-jonas:
    Unable to find/resolve artifact.: Could not find artifact org.codehaus.cargo:simple-ear:ear:1.10.28-SNAPSHOT -> [Help 1]

To build on these JDKs, you have to "pre-build" in JDK 11 and copy over the repository to with JDK 8 or JDK 12 or above. As an example, you can look at how multi-JDK build and tests are defined in the Codehaus Cargo Continous Integration YAML file.