...
These are the various XML configuration elements that you can use to configure the Cargo Maven2 pluginAnt tasks. Make sure you also check the examples which show how to use them.
Top level configuration elements | Description | Mandatory? | Default value |
---|---|---|---|
Definition of a Configuration | Defaults to a standalone configuration if the container is of type local and a runtime one if it's of type remote | ||
Definition of a Container | Defaults to a Jetty 7.x installed container if not specified | ||
Definition of a Deployer | Defaults to a deployer matching the container's type if none is specified (installed local deployer for an installed container, remote deployer for a remote container and embedded local deployer for an embedded container) | ||
A list of deployables that are going to be deployed in the container when it is started or when | If the project's packaging is | ||
Additional configuration that is used when deploying with the Cargo Daemon. | For more information, please read: Cargo Daemon. | ||
| Set this to | Defaults to |
...
<configuration>
elements
...
Description
...
Mandatory?
...
Default value
...
...
List of Configuration files that are to be added to a local container's configuration. Each file is specified using a <configfile>
element. Cargo token replacement is applied to the files and any existing file is overwritten.
...
...
No default
...
...
List of files that are to be added to a local container's configuration. Each file is specified using a <file>
element.
...
...
No default
...
<home>
...
For standalone configuration this is the location where Cargo will create the configuration and for existing configuration this is where it is located
...
...
${project.build.directory}/cargo/configurations/${containerId
}
...
<implementation>
...
Full classname of a custom configuration implementation to use. In that case the custom configuration is registered with the <containerId>
and <type>
specified
...
...
Defaults to the Cargo-provided implementation if not specified
...
...
Values to use for various Configuration properties.
You can also use the <propertiesFile>
element to load configuration properties from a file.
...
...
Code Block |
---|
mvn -Dcargo.servlet.port=8082 cargo:start
|
In addition to this, properties can also be set using the Maven2 settings.xml
file. See the setting configuration options via the Maven settings.xml section for details.
...
Values to use for various XML replacements.
...
...
No default
...
<type>
...
Configuration's type. Valid values are standalone
, existing
and runtime
...
...
standalone
...
...
No default
...
| Description | Mandatory? | Default value | |||||
---|---|---|---|---|---|---|---|---|
| If |
| ||||||
| Action to execute. These can be:
| No default | ||||||
<containerId> | Id of the container to use. Valid values can be found in the description page for each container | No default | List of extra dependencies or shared dependencies that will be added to the container or applications execution classpath. | |||||
| The container's type. Valid values are | Default value is | ||||||
| Location where the container is installed. If specified in conjunction with the | or element, it will override the home directory defined by the installer | No default If the user has not defined any | , nor | element then the | plugin Ant task will automatically attempt to download the container using the URL used by its tests (see the Tested On section of each container). |
| |
Defines the location of a | custom container implementation to use. In that case, the custom container is registered with the container distribution zip that will be downloaded and installed | No default If the user has not defined any | ||||||
The timeout after which Cargo reports an error if the container is not started or stopped |
| |||||||
List of
You can also use the | No default | |||||||
| Additional classpath entries for the classpath that will be used to start the containers. | No default | ||||||
| Classpath entries for the classpath that will be shared the applications deployed in a container. Shared application classpath deployment is only available for local containers which support shared Application Classpaths. | No default | ||||||
| Path to a file where Cargo logs are saved | Logs to the | Maven Ant console if no log file is specified | |||||
| Path to a file where container logs are saved | Logs to the file specified by the | the Maven the Ant console if no such file has been specified | |||||
List of
You can also use the | No default | |||||||
The timeout after which Cargo reports an error if the container is not started or stopped |
| |||||||
| The container
| If |
| |||||
Definition of a Configuration | Defaults to a standalone configuration if the container is of type local and a runtime one if it's of type remote | |||||||
Additional configuration that is used when deploying with the Cargo Daemon. | For more information, please read: Cargo Daemon. |
Anchor | ||||
---|---|---|---|---|
|
| Description | Mandatory? | Default value | |||
---|---|---|---|---|---|---|
| Configuration's type. Valid values are | | | | Default value is | |
Defines the location of a container distribution zip that will be downloaded and installed | No default If the user has not defined any | |||||
Defines the location of a container Maven artifact that will be downloaded and installed | No default If the user has not defined any |
...
| Description | Mandatory? | Default value |
---|---|---|---|
| Deployer implementation class. Usage of this option is not recommended, please prefer | No default | |
| The deployer's type. | Defaults to a deployer matching the container's type if none is specified (installed local deployer for an installed container, remote deployer for a remote container and embedded local deployer for an embedded container) |
...
| |||||
| For standalone configuration this is the location where Cargo will create the configuration and for existing configuration this is where it is located | No default | |||
Values to use for various Configuration properties.
You can also use the | Default configuration properties
| ||||
A list of deployables that are going to be deployed in the container when it is started or when | No default | ||||
List of Configuration files that are to be added to a local container's configuration. Each file is specified using a | No default | ||||
List of files that are to be added to a local container's configuration. Each file is specified using a | No default | ||||
<xmlReplacements> | Values to use for various XML replacements. | No default | |||
<users> | List of users to be created in container configuration. | No default |
Anchor | ||||
---|---|---|---|---|
|
| Description | Mandatory? | Default value |
---|---|---|---|
| The configuration file or directory containing configuration files. | No default | |
| The target directory, relative to configuration home, where the file should be copied | If not specified, the file will be copied to the configuration's home directory | |
| The target file name to use | The original file name |
...
| Description | Mandatory? | Default value | ||||
---|---|---|---|---|---|---|---|
| Maven artifact id for the module. This artifact id must match either the project's artifact id if your project generates a J2EE artifact (WAR, EAR, EJB and RAR) or it must match a specified | Defaults to the project's artifact id | |||||
| Maven group id for the module. This group id must match either the project's group id if your project generates a J2EE artifact (WAR, EAR, EJB and RAR) or it must match a specified | Defaults to the project's group id | |||||
| Deployable implementation class. Usage of this option is not recommended, please prefer | No default | |||||
| Path location where the module can be found | Default's to the project's generated artifact location or to the specified | Deployable type, i.e. | No default | |||
| The deployable file. | No default | |||||
| URL on which to ping the deployed or undeployed application (to check if deployment or undeployment is successful), that should return an HTTP OK response only after the deployment is complete. If not set, the deployed or undeployed application will not be pinged, hence the deployment considered as complete as soon as the target server's method returns successfully. | No default | <pingUrlPath>URL path used to ping the deployed or undeployed application. It has similar functionality as | No default | |||
| If |
| |||||
User-defined properties of a deployable. | No default | ||||||
| Maven type for the module. This type must match either the project's packaging if your project generates a J2EE artifact (WAR, EAR, EJB and RAR) or it must match a specified | Defaults to the project's packaging |
Anchor | ||||
---|---|---|---|---|
|
| Deployable Type | Description | Mandatory? | Default value |
---|---|---|---|---|
| WAR | The context name to use when deploying the web application. | Default's to the artifact's | |
| WAR | The path of the WAR being deployed. | Default's to the project's generated artifact locationfile name without the extension | |
| EAR | The path of the EAR being deployed. | Default's to the project's generated artifact locationthe file name without the extension | |
| EAR | The name of EAR deployable (it can be anything, there's no special rule). | Default's to the artifact's | |
| EJB | The path of the EJB being deployed. | Default's to the project's generated artifact locationthe file name without the extension |
Info | ||
---|---|---|
| ||
Many containers have their specific files for redefining context roots (Tomcat has context.xml, JBoss has jboss-web.xml, etc.). If your WAR has such a file, the server will most probably use the context root defined in that file instead of the one you specify using the CARGO deployer. |
...
Anchor | dependency | dependency |
---|
...
<dependency>
elements
...
Description
...
Mandatory?
...
<artifactId>
...
Maven's artifact id. This artifact id must match a specified <project>/<dependencies>/<dependency>
artifact id
...
...
Defaults to the project's artifact id
...
<groupId>
...
Maven's group id. This group id must match a specified <project>/<dependencies>/<dependency>
group id
...
...
Defaults to the project's group id
...
<type>
...
Maven's type. This type must match a specified <project>/<dependencies>/<dependency>
type
...
...
Defaults to the project's packaging
...
<classpath>
...
Target classpath, either extra
(default) or shared
. Shared application classpath deployment is only available for local containers which support shared Application Classpaths.
...
...
extra
(container classpath)
...
<location>
...
The path of a folder or a jar file you wish to add to deployable classpath. This element can be used to explicitly add entries to the classpath. For example:
Code Block |
---|
<dependency>
<location>src/main/resources/conf</location>
</dependency>
|
...
...
If the groupId and artifactId match those of the project then the deployable is the artifact generated by the project. Otherwise the location is the location of the dependency in your local respository.
Anchor | |||
---|---|---|---|
|
| Description | Mandatory? | Default value |
---|---|---|---|
| URL from which to download the container's ZIP or TAR.GZ file. | No default | |
| Directory in which the |
| |
| Directory in which the |
| |
Proxy server settings, if required. | No default |
Anchor | ||||
---|---|---|---|---|
|
Info | ||
---|---|---|
| ||
Note that CARGO will by default reuse existing Maven2 proxy configuration -so you won't need to type the proxy settings for the |
| Description | Mandatory? | Default value |
---|---|---|---|
| Proxy host name or IP address. | No default | |
| Proxy port. | Very probably | |
| User name to connect to the proxy server. | No default | |
| Password to connect to the proxy server. | No default |
...
| Description | Mandatory? | Default value | |||
---|---|---|---|---|---|---|
| Group id. | No default | ||||
| Artifact id. | No default | ||||
| Version. | No default | ||||
| Artifact type. |
|
| Classifier. | No default | |
| Directory in which the |
|
Anchor | ||||
---|---|---|---|---|
|
<user> elements | Description | Mandatory? | Default value | |||||
---|---|---|---|---|---|---|---|---|
<name> | User name. | No default | ||||||
<password> | User password. | No default | ||||||
<roles> | List of roles which should be assigned to user. Example of roles configuration:
| No default |
...
Info | ||
---|---|---|
| ||
For the Maven2/Maven3 pluginAnt tasks, the "daemonized server" is actually a local container with a hostname that points to a remote machine. This implies that:
When you call
|
...
| Description | Mandatory? | Default value |
---|---|---|---|
| URL to connect with the daemon. | No default | |
| The handle id to register this container with. | No default | |
| When set to |
| |
<cargo.daemon.username> | Username used when authenticating against the daemon host | admin | |
<cargo.daemon.password> | Password used when authenticating against the daemon host | "" (empty String) |
...
Setting configuration options via the Maven settings.xml
The Cargo Maven2/Maven3 plugin also allows you to define container configuration properties using the settings.xml
file. This way, you can for example store properties like usernames and passwords in a centralized location (as opposed to pom.xml
files).
First, add the configuration properties you would like in your settings.xml
file's <servers>
section:
...
<servers>
<server>
<id>jonas1</id>
<configuration>
<cargo.remote.uri>jmx://jonas1</cargo.remote.uri>
<cargo.jonas.domain.name>jonas</cargo.jonas.domain.name>
<cargo.remote.username>jonas</cargo.remote.username>
<cargo.remote.password>jonas</cargo.remote.password>
</configuration>
</server>
<servers>
Then, in the Cargo plugin's configuration, use the cargo.server.settings
property in order to reference the configuration properties that you have previously defined. For example:
...
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
[...]
<configuration>
<properties>
<cargo.server.settings>jonas1</cargo.server.settings>
</properties>
</configuration>
</configuration>
</plugin>
In this case, the plugin will internally "expand" the configuration into:
...
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
[...]
<configuration>
<properties>
<cargo.remote.uri>jmx://jonas1</cargo.remote.uri>
<cargo.jonas.domain.name>jonas</cargo.jonas.domain.name>
<cargo.remote.username>jonas</cargo.remote.username>
<cargo.remote.password>jonas</cargo.remote.password>
</properties>
</configuration>
</configuration>
</plugin>
...
title | Careful with properties set in the POM |
---|
Priority for property values are as follows:
...