Maven: Tomcat ref
mvn tomcat[6/7]:help
provides plugin goals summary.
Using embedded Tomcat6
Add tomcat6-maven-plugin to pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
and issue
mvn tomcat6:run
Using local Tomcat6
Check that tomcat user with manager role exists in tomcat-users.xml:
<tomcat-users>
<user password="secret" roles="manager,admin" username="admin"/>
</tomcat-users>
Add authentication info for tomcat manager to maven (e.g. /.m2/settings.xml):
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>Tomcat6</id>
<username>admin</username>
<password>secret</password>
</server>
</servers>
</settings>
Add server description to tomcat6-maven-plugin configuration:
<configuration>
<server>Tomcat6</server>
<path>/</path>
</configuration>
References
latest version