Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here are the different task actions available to call on this plugin:

Action

Description

start

Start a container. That task will:

Note: A container that's started with the start task will automatically shut down as soon as the parent ANT instance quits (i.e., you see a BUILD SUCCESSFUL or BUILD FAILED message). If you want to start a container and perform manual testing, see our next task run.

run

Start a container and wait for the user to press CTRL + C to stop. That task will:

stop

Stop a container.

restart

Stop and start again a container. If the container was not running before calling restart, it will simply be started.

configure

Create the configuration for a local container, without starting it. Note that the start and run actions will also install the container automatically.

daemon-start

Start a container using the Cargo Daemon.

daemon-stopStop a container using the Cargo Daemon.

deploy

Deploy a deployable to a running container.

undeploy

Undeploy a deployable from a running container.

redeploy

Undeploy and deploy again a deployable. If the deployable was not deployed before calling redeploy, it will simply be deployed.

Info
titleWait after the container has started

Many wonder the difference between the start and run actions:

  • If you want to just start the container and then do other tasks (for example, execute tests), use the start action. That action should therefore ONLY be used for integration testing.
  • If you want start the container and have ANT "blocked" afterwards (i.e., until you press CTRL + C to stop), use the run action. run is therefore the action to use for manual testing.

Include Page
Ant Tasks Reference Guide
Ant Tasks Reference Guide

Examples

Anchor
examples
examples

...

  • Add additional properties for defining the following:

    Property

    Description

    tomcat.home

    Installation directory of tomcat5x

    tomcatlog.dir

    This is where our logs are going to be generated

    tomcatconfig.dir

    Cargo needs an empty config folder

    pathtowarfile

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

  • Add the following code to your build.xml :

    Code Block
    xml
    xml
    <taskdef resource="cargo.tasks">
      <classpath>
        <pathelement location="${cargo-uberjar}"/>
        <pathelement location="${cargo-antjar}"/>
      </classpath>
    </taskdef>
    	
    <target name="cargostart" depends="war">
      <delete dir="${tomcatconfig.dir}" />
      <mkdir dir="${tomcatlog.dir}"/>
      <mkdir dir="${tomcatconfig.dir}"/>
      <echo message="Starting Cargo..."/>
      <echo message="Using tomcat.home = ${tomcat.home} "/>
      <echo message="Using war = ${mywarfile} "/>
      <echo message="Jars used = ${cargo-uberjar} , ${cargo-antjar}"/>
    		
      <cargo containerId="tomcat5x" home="${tomcat.home}" output="${tomcatlog.dir}/output.log" 
          log="${tomcatlog.dir}/cargo.log" action="start">
        <configuration home="${tomcatconfig.dir}">
          <property name="cargo.servlet.port" value="8080"/>
          <property name="cargo.logging" value="high"/>
          <deployable type="war" file="${mywarfile}"/>
        </configuration>
      </cargo>
    
    </target>
    

...