groupId and Mojo name change
Since version 2.0-beta-1 tomcat mojos has been renamed to tomcat6 and tomcat7 with the same goals.
You must configure your pom to use this new groupId:
Or add the groupId in your settings.xml
Known limitations
Some goals are not yet available with the tomcat7 mojo. Those container goals are available with the tomcat6 mojo, you only need to update the manager url in your pom.
Use http://localhost:8080/manager/text rather than the default tomcat6 url.
Context Goals
Redeploying a WAR project
The goals required to redeploy a WAR project depend upon how it was deployed:
- To redeploy a WAR project deployed by tomcat:deploy you can type:
- To redeploy a WAR project deployed by tomcat:exploded you can type:
- To redeploy a WAR project deployed by tomcat:inplace you can type:
- To redeploy a context.xml file deployed by tomcat:deploy you can type:
Note: Depending on the docBase specified in the context.xml you may also need to call war:exploded or war:inplace as above.
Container Goals
Listing deployed applications
To list all the currently deployed applications in Tomcat you can type:
Listing server information
To list information about the Tomcat version, OS, and JVM properties you can type:
Listing JNDI resources
To list all the JNDI resources available within Tomcat you can type:
Alternatively, to list only JNDI resources of a specific type you can type:
Build an Executable War/Jar
Starting with Version 2.0 of the plugin you can build an executable war/jar with an embedded Apache Tomcat7.
This is only supported with the tomcat7 plugin.
Note Your project must have a packaging value of pom or war.
Run Mojo: run your Maven war project quickly!
When developing a war project, you usually build your war and deploy it to an installed Tomcat instance. This is time and resources consuming and also requires a local Tomcat instance.
The run mojo gives you the opportunity to avoid those efforts by simply running your war inside an embedded Tomcat instance in your Maven build.
NOTE If you have a multi module Maven project and use Maven3, you don't need to install all modules before using the run goal, just use tomcat6/7:run from the root module and the plugin will auto detect the build output directory from various modules and replace dependencies with those directories in the webapp classloader.
Running an embedded Tomcat
Configure your pom with the plugin version (for other mojo parameters see each mojo's documentation).
And use: mvn tomcat6/7:run