Access Keys:
Skip to content (Access Key - 0)
Cancel    
Cancel   

Contents

MuleSoft provides a set of Maven archetypes for web applications that wish to leverage Apache Tomcat or Tcat as their integration test container of choice. This is part of our commitment to give back to the Tomcat community from whom we've received so much value. The archetypes  the maven-archetype-webapp and the wicket-archetype-quickstart had fallen out of date, both in terms of using the new Archetype 2.0 style metadata, as well as in the dependencies on the third-party libraries such as JUnit. We updated these archetypes to take advantage of new Archetype 2.0 style metadata and also to use new 2.0 lifecycle extensions

The homepage for this project is: http://admin.muleforge.org/projects/maven2

The source code to these archetypes is available at GitHub under the MuleSoft account at:
http://github.com/mulesoft/mulesoft-maven-archetypes

Add the archetype repository

To use either of these two archetypes you can either 1) specify the archetype catalog, or 2) add the http://repository.muleforge.org/ repository to your ~/.m2/settings.xml file.

The web application archetype, via catalog

1)
You can interactively work with these two archetypes by identifying their archetype catalog. Just type:

mvn archetype:generate -DarchetypeCatalog=http://dist.muleforge.org/maven2/

The web application archetype, command line params


or alternately, 2) for the JSP flavor of the archetype...
Or, if you've added the repository as a mirror to your settings.xml or repository manager, you can just invoke the archetype creation directly with all parameters. This runs the archetype with the full set of parameters supplied at the command line.

mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate\
-DarchetypeGroupId=org.mule.tools.maven2.archetypes\
-DarchetypeArtifactId=tomcat-webapp-archetype\
-DarchetypeVersion=1.0.4\
-DgroupId=com.mysamplecompany\
-DartifactId=temp-sample-jsp-webapp\
-Dversion=1.0-SNAPSHOT

or for the wicket flavor of the archetype...

mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate\
-DarchetypeGroupId=org.mule.tools.maven2.archetypes\
-DarchetypeArtifactId=tomcat-wicket-archetype\
-DarchetypeVersion=1.0.4\
-DgroupId=com.mysamplecompany\
-DartifactId=temp-sample-jsp-webapp\
-Dversion=1.0-SNAPSHOT

The archetype plugin version is specified at the command line so that we get the latest version of this tool. The default version (if version is unspecified) is a little older and we are maximizing the use of the latest version's features.

The web application archetype, interactive prompt

or alternately 2B) for a JSP flavored web app
If you wish to be interactively prompted for the archetype inputs, you can leave off the final four parameters.

mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate\
-DarchetypeGroupId=org.mule.tools.maven2.archetypes\
-DarchetypeArtifactId=tomcat-webapp-archetype\
-DarchetypeVersion=1.0.4

or for a Wicket flavored webapp

mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate\
-DarchetypeGroupId=org.mule.tools.maven2.archetypes\
-DarchetypeArtifactId=tomcat-wicket-archetype\
-DarchetypeVersion=1.0.4

Run Tomcat/Tcat


By default, when deploying the app so that integration tests can be run, the Maven Tomcat plugin expects the Tomcat/Tcat instance to be configured with an administrative username of "admin" and a blank password. The Maven usage of Tomcat can easily be configured to use a different username and password in the plugin's <config> section of the pom.xml. Corresponding Tomcat user credentials are configured in the $CATALINA_HOME/conf/tomcat-users.xml file.

Running the build


Now that the archetype is instantiated and Tomcat is running, cd into the archetype-created directory. Next, run the build via:
mvn install

You'll notice that it installs the application to the localhost running instance of Tomcat during the pre-integration-test phase, and then runs the integration tests (JWebUnit, HttpUnit) against the live pages in the web container.

Congratulations! You have a basic JSP or Wicket application that is set up to run integration tests on Tomcat.