Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 24 Next »


Cargo provides Ant tasks to perform all the operations available from the Java API

Functional tests


The usage of Cargo for executing functional tests on a container does not mandate these ANT tasks. You could directly use the Cargo Java API from your Java unit test classes (JUnit, TestNG, etc), as described on the Functional testing page.


Before using the Ant API you need to register the Cargo Ant tasks into Ant. This is done in the following manner:

Some additional dependencies might also be required for the ANT task. Please see the Installation page for details.

Wait after the container has started


If using Cargo for integration tests, remember to set the wait parameter of the <cargo> task to false, otherwise Cargo will start the container and show the following message: Press Ctrl-C to stop the container.... The default value for the wait parameter is:

  • For CARGO 1.1.0 and onwards, false
  • For older versions, true


Orion 2.x

Here's a full example showing how to deploy a WAR, and expanded WAR and an EAR in an Orion 2.x container. Please note that the output and log attribute are optional. The property elements allow you to tune how the container is configured. Here we're telling it to start on port 8180 and to generate the maximum amount of logs in the container output file.

Tomcat 5.x

This example gives a walk through of how to get a Cargo Ant build to work with Tomcat 5.x .

  • It is assumed that Tomcat 5.x is already installed
  • The cargo-core-uberjar.jar and cargo-ant.jar JARs have been downloaded
  • A mimimum knowledge of Ant is required
  • User already has a war target that properly generates a working war file

Follow the following steps to configure your build.xml :

  • Create a folder under your basedir called cargolib that will hold cargo-core-uberjar.jar and cargo-ant.jar
  • Define a property for cargolib
  • Define 2 new properties cargo-uberjar and cargo-antjar as shown below:
  • Add additional properties for defining the following:




    Installation directory of tomcat5x


    This is where our logs are going to be generated


    Cargo needs an empty config folder


    The full path of the war file e.g c:/devtools/myapp/dist/myfile.war

  • Add the following code to your build.xml :

Remote deployment

Remote deployer availability


Please note that the remote deployer is only available with CARGO 1.1.0 and onwards.

Here's a full example showing how to deploy a WAR to a remote Tomcat 6.x container.

  • No labels