Cargo : Maven1 plugin

Maven 2 plugin

This page is dedicated for the Maven 1 plugin (the old Maven). There's also a Maven2/Maven3 plugin, and that one is very probably what you're looking for.

Installation

To automatically install the plugin, type the following on a single line:

maven plugin:download
  -DgroupId=org.codehaus.cargo
  -DartifactId=cargo-maven-plugin
  -Dversion=X.X(.X)

where X.X(.X) is the release number you want to install (0.6 is the first available).

Note that for versions earlier or equal to 0.7 you'll need to use a group id of cargo instead of org.codehaus.cargo.

Plugin goals

goal

description

cargo:start

Starts all containers defined by the cargo.containers property

cargo:stop

Stops all containers defined by the cargo.containers property

Plugin properties

Property name

Required?

Description

Default

cargo.containers

(grey lightbulb)

A list of containers ids that specifies on which containers to apply the goal. If this property is empty the Maven plugin will do nothing. You must define for each containerName the corresponding settings.

empty

cargo.zipUrlInstaller.<installerId>.installUrl

(lightbulb)

URL from where the container archive can be downloaded.

empty

cargo.zipUrlInstaller.<installerId>.installDir

(lightbulb)

The path where the container will be downloaded and extracted.

empty

cargo.proxy.host

(grey lightbulb)

Proxy hostname (IP or server name).

${maven.proxy.host}

cargo.proxy.port

(grey lightbulb)

Proxy port.

${maven.proxy.port}

cargo.proxy.user

(grey lightbulb)

Proxy username.

${maven.proxy.user}

cargo.proxy.password

(grey lightbulb)

Proxy password.

${maven.proxy.password}

cargo.proxy.excludehosts

(grey lightbulb)

A list of hosts to bypass the proxy on (if any). These should be separated with the vertical bar character '|'. Only in Java 1.4 does FTP use this list.

empty

cargo.container.wait

(grey lightbulb)

Whether Maven should block after the container is started or not

true

cargo.container.<containerName>.containerId

(lightbulb)

The container id.

empty

cargo.container.<containerName>.home

(grey lightbulb)

The path where the container is installed.

empty

cargo.container.<containerName>.zipUrlInstaller

(grey lightbulb)

The id of a zipUrLInstaller.

empty

cargo.container.<containerName>.output

(grey lightbulb)

The path for the file to which output of the container should be written.

empty

cargo.container.<containerName>.log

(grey lightbulb)

The path for the cargo log file.

empty

cargo.container.<containerName>.timeout

(grey lightbulb)

Timeout (in milliseconds) to wait to see if the container is started/stopped.

empty

cargo.container.<containerName>.deployables

(grey lightbulb)

A list of deployable Ids. Each deployable must be defined using the deployables settings.

empty

cargo.container.<containerName>.config.type

(lightbulb)

The type to differentiate the configuration from others for the specified container.Currently the only type supported by cargo is : standalone.

empty

cargo.container.<containerName>.config.home

(lightbulb)

The home directory for the configuration of the container.

empty

cargo.container.<containerName>.config.standalone.servlet.port

(grey lightbulb)

Port on which the Servlet/JSP container will listen to.

empty

cargo.container.<containerName>.config.standalone.hostname

(grey lightbulb)

Host name on which the container will listen to.

empty

cargo.container.<containerName>.config.standalone.logging

(grey lightbulb)

Level representing the quantity of information we wish to log. Valid values are low | medium | high.

empty

cargo.container.<containerName>.config.standalone.jvmargs

(grey lightbulb)

JVM args to be used when starting/stopping containers.

empty

cargo.container.<containerName>.start.output

(grey lightbulb)

The path for the file to which output of the container should be written when it starts.

empty

cargo.container.<containerName>.start.log

(grey lightbulb)

The path for the cargo log file when the start action is called for this container.

empty

cargo.container.<containerName>.stop.output

(grey lightbulb)

The path for the file to which output of the container should be written when it stops.

empty

cargo.container.<containerName>.stop.log

(grey lightbulb)

The path for the cargo log file when the stop action is called for this container.

empty

cargo.container.<containerName>.sysproperties

(grey lightbulb)

A list of system properties to be passed to the container, separated by space. Each property is described in a sub property. Example:

cargo.container.tomcat.sysproperties = sysprop1 sysprop2
sysprop1 = foo
sysprop2 = bar

empty

cargo.container.<containerName>.config.standalone.orion.rmi.port

(grey lightbulb)

Port for the Orion RMI server. (Orion 1x, 2x or Oc4j 9x)

empty

cargo.container.<containerName>.config.standalone.tomcat.shutdown.port

(grey lightbulb)

TCP/IP port number on which this server waits for a shutdown command. (Tomcat 4x or 5x)

empty

cargo.deployable.<deployableId>.type

(lightbulb)

Deployable type : war | ear.

empty

cargo.deployable.<deployableId>.file

(grey lightbulb)

Absolute path to the deployable file (or the expanded webapp directory).

empty

Be Careful

Exactly one of cargo.container.<containerName>.home and cargo.container.<containerName>.zipUrlInstaller must defined.

Samples

All properties sample (incoherent settings)

cargo.containers = myresin,myorion,myjetty
cargo.zipUrlInstaller.myresin.installUrl = http://www.caucho.com/download/resin-3.0.9.zip
cargo.zipUrlInstaller.myresin.installDir = $\{maven.build.dir}/installs
cargo.proxy.host = myproxy.mycompany.com
cargo.proxy.port = 1080
cargo.proxy.user = vmassol
cargo.proxy.password = somepassword
cargo.proxy.excludehosts = fozbot.corp.sun.com\|\*.eng.sun.com
cargo.container.myresin.containerId = resin3x
cargo.container.myresin.home = c:/apps/resin/
cargo.container.myContainer.zipUrlInstaller = myContainerInstallerId
cargo.container.myContainer.output = $\{maven.build.dir}/myContainer/logs/container.log
cargo.container.myContainer.log = $\{maven.build.dir}/myContainer/logs/cargo.log
cargo.container.myContainer.timeout = 120000
cargo.container.myContainer.deployables = myEarId, myWarId
cargo.container.myContainer.config.type = standalone
cargo.container.myContainer.config.home = $\{maven.build.dir}/myContainer/config
cargo.container.myContainer.config.standalone.servlet.port = 8280
cargo.container.myContainer.config.standalone.hostname = myserver
cargo.container.myContainer.config.standalone.logging = high
cargo.container.myContainer.config.standalone.jvmargs = -Xmx64m -Xms2m
cargo.container.myContainer.start.output = $\{maven.build.dir}/myContainer/logs/container-start.log
cargo.container.myContainer.start.log = $\{maven.build.dir}/myContainer/logs/cargo-start.log
cargo.container.myContainer.stop.output = $\{maven.build.dir}/myContainer/logs/container-stop.log
cargo.container.myContainer.stop.log = $\{maven.build.dir}/myContainer/logs/cargo-stop.log
cargo.container.myContainer.config.standalone.orion.rmi.port = 25791
cargo.container.myContainer.config.standalone.tomcat.shutdown.port = 8205
cargo.deployable.myDeployableId.type = war
cargo.deployable.myDeployableId.file = $\{maven.war.build.dir}/$\{maven.war.final.name}

Minimal settings to start and stop a container

Example with tomcat already installed:

maven.xml
<preGoal name="cargo:start">
  <ant:mkdir dir="$\{maven.build.dir}/myTomcat/config"/>
</preGoal>
project.properties
cargo.containers = myTomcat

cargo.container.myTomcat.containerId = tomcat5x
cargo.container.myTomcat.home = C:/Programs/web/jakarta-tomcat-5.0
cargo.container.myTomcat.config.type = standalone
cargo.container.myTomcat.config.home = $\{maven.build.dir}/myTomcat/config
cargo.container.myTomcat.config.standalone.servlet.port = 8280
cargo.container.myTomcat.config.standalone.logging = high

IDE support

Netbeans

There's a Netbeans module working with Mevenide for Netbeans. The module adds a panel into the Maven project's customizer. It eases the setup of the Maven plugin properties and visualizes the current settings.

The current version of the module is 1.0, it works with Mevenide 0.8.1 and later and Netbeans 4.1 and Netbeans 5.0 beta. It can be downloaded here. After download, start Netbeans and install the module through the AutoUpdate Center.

Sample screenshot

Attachments:

cargomaven1.png (image/png)
cargomaven2.png (image/png)