Java API
Cargo offers primarily a Java API. It is meant to be embedded in your application. You'll need Java SE version 8 or greater.
You have two choices to pick from the Downloads page:
- the
cargo-core-api-*
jars and the container implementations you wish to use (cargo-core-container-*
jars) - or the
cargo-core-uberjar
jar which aggregates all the required jars
Cargo's base dependencies are as follows:
- Ant 1.9.15 or greater
- Commons discovery 0.5 or greater
- Commons logging 1.2 or greater
Security issues with older versions of Apache Ant
Apache Ant 1.1 to 1.9.14 and 1.10.0 to 1.10.7 uses the default temporary directory identified by the Java system property java.io.tmpdir
for several tasks and may thus leak sensitive information. Moreover, the fixcrlf
and replaceregexp
tasks copy files from the temporary directory back into the build tree allowing an attacker to inject modified source files into the Codehaus Cargo container configuration generation process. We hence strongly recommend only using versions 1.9.15 (for Ant 1.9.x) or versions 1.10.8 and above.
In addition, some specific containers (for example, JRun or WildFly / WildFly Swarm) and some deployables (for example, Tomcat WARs) require the following:
- jdom 1.1.3 (not any jdom2 version)
- jaxen 1.1.6 or greater
- JSON.simple 1.1.1 or greater
- Jackson core 2.10.1 or greater, Jackson YAML dataformat 2.10.1 or greater and SnakeYAML 1.24 or greater
- The convenience JAR with DTDs that are used by some Cargo components which have licenses incompatible with the rest of Cargo, in case you want to use the Java API offline with some containers / deployables
Apache Ant
If you want use the Cargo Ant tasks, add the following JARs to Ant's classpath:
- The same jars as for the Java API (i.e., either the API JARs + the container(s) or the uberjar)
- The
cargo-ant
JAR, containing the<taskdef>
definition (see the Ant support page)
Apache Maven 3
Maven 3 will automatically download all required dependencies: see the Maven 3 Plugin page. As a result, no installation is required for Maven 3.
If you are creating a Java applications which use the Cargo via API, you need to add as dependency either the artifact for your favorite container or the uberjar (which contains all containers). See below
<dependency> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-core-uberjar</artifactId> <version>${cargo.version}</version> </dependency>
<dependency> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-core-container-tomcat</artifactId> <version>${cargo.version}</version> </dependency>