If no explicit configuration is provided then the Tomcat7 Maven Plugin defaults to the following:
These can be overridden as described below.
To configure the plugin for a different Tomcat instance, add a plugin configuration block to your pom.xml as follows:
<project> ... <build> ... <plugins> ... <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <url>http://www.mydomain.com:1234/mymanager</url> </configuration> </plugin> ... </plugins> ... </build> ... </project>
The default Tomcat manager URL is http://localhost:8080/manager/text.
To specify a different username and password to use when authenticating with Tomcat manager:
<project> ... <build> ... <plugins> ... <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <server>myserver</server> </configuration> </plugin> ... </plugins> ... </build> ... </project>
<settings> ... <servers> ... <server> <id>myserver</id> <username>myusername</username> <password>mypassword</password> </server> ... </servers> ... </settings>
The default authentication details are username admin and no password.
The default context path is /${project.artifactId}.
To change the context path to /mycontext configure the plugin like this:
<project> ... <build> ... <plugins> ... <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <path>/mycontext</path> </configuration> </plugin> ... </plugins> ... </build> ... </project>
If you are using project.build.finalName to change the name of your WAR file, you can use that value when you configure the context path as well. To do that add the following configuration block to your pom.xml:
<project> ... <build> ... <finalName>mycontext</finalName> ... <plugins> ... <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <path>/${project.build.finalName}</path> </configuration> </plugin> ... </plugins> ... </build> ... </project>