Cargo : Maven2 Archetypes
This page last changed on May 09, 2011 by afloom.
Maven2 ArchetypesMaven2 has a powerful feature called Archetype. As part of the Cargo project we have created some archetypes that you can use to get a working sample project that uses the Cargo Maven2 plugin. Single Webapp Module ArchetypeShows how to configure Cargo and Maven2 to run functional tests directly from a single webapp module. To run it, execute (one one line): mvn archetype:generate -DarchetypeGroupId=org.codehaus.cargo -DarchetypeArtifactId=cargo-archetype-webapp-single-module -DarchetypeVersion=<version> where <version> is the version of the Cargo Archetype, as a result the CARGO version to use (for example 1.1.0). Users of Maven 3, please be aware of the ARCHETYPE-351 bug. Until a new version of the maven-archetype-plugin is released, you might need to add the path to the archetype repository (most likely Maven central, unless you're using a Maven repository Manager) by specifying "-DarchetypeRepository=http://repo1.maven.org/maven2" as well. 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, simply run: mvn clean verify That command will:
That archetype also demonstrates another powerful feature of CARGO coupled with Maven. If you now run: mvn clean verify -P tomcat6x the same steps will be done with Tomcat instead of Jetty; thanks to Maven's profiles. The archetype actually ships with Maven profiles for the jetty7x (default), jetty6x, tomcat6x, jonas5x, jboss51x and glassfish3x 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, some others an embedded, some download the server using the ZipUrlInstaller and some others using the ArtifactInstaller. You can of course add and use any other container from the Containers list. Separate Functional Test Module ArchetypeShows how to configure Cargo and Maven2 to run functional tests by creating a functional tests module next to the webapp module. To run it, execute (one one line): mvn archetype:generate -DarchetypeGroupId=org.codehaus.cargo -DarchetypeArtifactId=cargo-archetype-webapp-functional-tests-module -DarchetypeVersion=<version> where <version> is the version of the Cargo Archetype, as a result the CARGO version to use (for example 1.1.0). |
![]() |
Document generated by Confluence on Jun 14, 2011 22:09 |