Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Maven2 Archetypes

Maven2 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 Archetype

Shows how to configure Cargo and Maven2 to run functional tests directly from a single webapp module. To run it, execute:

where

  • <version> is the version of the Cargo Archetype, as a result the CARGO version to use (for example 1.0.6)
  • <application groupId> is the Maven groupId of the application that will be generated
  • <application artifactId> is the Maven artifactId of the application that will be generated
  • <application version> is the Maven version of the application that will be generated

For example:

Once your Maven project is generated, simply run:

That command will:

  • Build the web application
  • If needed, download Jetty
  • Configure Jetty
  • Start an embedded Jetty container
  • Deploy your web application to the Jetty container
  • 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

That archetype also demonstrates another powerful feature of CARGO coupled with Maven. If you now run:

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 jetty6x, tomcat6x, jonas5x, jboss51x and glassfish3x containers. You can of course add and use any other container from the Containers list.

Separate Functional Test Module Archetype

Shows 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:

  • No labels