MuleSoft Tcat Archetypes
|Tcat Server reached its End of Life in 2017. Contact your Customer Success Manager to determine options for managing, monitoring, or deploying your application.|
MuleSoft provides a set of Maven archetypes for web applications you may wish to use: Understanding 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 source code for these archetypes is available in GitHub at: MuleSoft Maven Archetypes
See: The JSP flavor of the archetype.
If you’ve added the repository as a mirror to your settings.xml or repository manager, you can 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 Wicket:
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.
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 Wicket:
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
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
Now that the archetype is instantiated and Tomcat is running, cd into the archetype-created directory. Next, run the build via:
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.