...
The archetype actually ships with Maven profiles for the jetty7x (default), jetty6x, tomcat6x, jonas5x, jboss51x, jboss71x, glassfish3x and glassfish3x geronimo3x containers. We tried to show with these archetypes as many examples as possible, so you will find that:
- Some of these profiles define a standalone container:
- The profiles jetty7x, jonas5x and , jboss71x and geronimo3x download the server using the ArtifactInstaller.
- The profiles jboss51x, glassfish3x and tomcat6x download the server using the ZipUrlInstaller.
- The profile jetty6x define an embedded container.
...
- Not all containers support datasources. For details configuring datasource, please read: DataSource and Resource Support.
- The profiles that ship with this archetype are jetty7x (default), tomcat6x, glassfish3x, jboss51x, jboss71x, jonas5x and jonas5x geronimo3x.
As in the other examples, what's interesting to see is that the datasource definition on CARGO remains the same even if you switch container; as CARGO handles all the container-specific datasource setup steps.
...
- tomcat6x (default), using the Tomcat manager
- jetty6x and jetty7x. Before using the Jetty remote deployer, please read: Jetty Remote Deployer.
- jonas5x
- jboss51x and jboss7x, including adding in the special dependencies for the JBoss remote deployer. For more details, please read: JBoss Remote Deployer.
- glassfish3x, including adding in the GlassFish-specific dependencies for JSR88. For more details, please read: JSR88.
| Anchor | ||
|---|---|---|
|
Daemon Archetype
Shows how to configure Cargo and Maven2 to use the Cargo Daemon's features in order to remotely start the container, deploy your deployable on it, do some tests, and shut the server down remotely. To run it, execute (one one line):
| Code Block |
|---|
mvn archetype:generate -DarchetypeGroupId=org.codehaus.cargo
-DarchetypeArtifactId=cargo-archetype-daemon
-DarchetypeVersion=<version>
|
where <version> is the version of the Cargo Archetype, as a result the CARGO version to use.
The Maven archetype plugin will then ask you what groupId, artifactId, version, and package you would like to use for generation. Once your Maven project is generated, you need to first start the Cargo Daemon. Then, simply run:
| Code Block |
|---|
mvn clean verify -Dhostname=<daemon.hostname> -Ddaemon.port=<daemon.port>
|
where <daemon.hostname> is the hostname / IP address of the machine running the Cargo Daemon and <daemon.port> the port for it.That command will:
- Build the web application
- If needed, download Jetty
- Send the downloaded Jetty package to the remote Cargo Daemon instance
- Configure Jetty on the remote machine
- Start the Jetty container on the remote machine
- Deploy your web application to the Jetty container on the remote machine
- Run some tests on the deployed application
- We've used classic JUnit tests, but you can use whatever you like, really
- Stop the Jetty container on the remote machine
The archetype actually ships with Maven profiles for the jetty7x (default), tomcat6x, jonas5x, jboss51x, jboss71x, glassfish3x and geronimo3x containers.
You can of course add and use any other container from the Containers list.