Maven integrates the tomcat plug-in and garbled solution, maventomcat
Maven is already the standard for Java project management. Many people are concerned about how to use Maven to call Web applications during Java EE development. This article describes how to use Maven to introduce the Tomcat plug-in.
Maven Tomcat plug-ins now mainly have two versions, tomcat-maven-plugin and tomcat7-maven-plugin, basically the same way to use.
Official tomcat-maven-plugin plug-in Website: http://mojo.codehaus.org/tomcat-maven-plugin/plugin-info.html.
Tomcat7-maven-plugin plug-in Official Website: http://tomcat.apache.org/maven-plugin.html.
Tomcat7-maven-plugin plug-in usage
Configuration
Add the following xml to pom. xm.
<Plugin> groupId> org. codehaus. mojo </groupId> <artifactId> tomcat-maven-plugin </artifactId> <version> 1.1 </version> <configuration>
<! -- Path is the path to access the application --> <path>/wp </path>
<! -- Port is the tomcat port number c --> <port> 8080 </port>
<! -- UriEncoding URL according to the UTF-8 encoding, this solves the Chinese parameter garbled --> <uriEncoding> UTF-8 </uriEncoding> <url> http: // localhost: 8080/manager/html </url>
<! -- Server specifies the tomcat name. -->
<Server> tomcat7 </server>
</Configuration>
</plugin>
Agent running
If Maven plug-in is installed in Eclipse, right-click the pom. xml file and choose Run As> Maven build> input tomcat7: run> run.
In this way, Tomcat 7 can run normally.
The following describes several common Goal
| Command |
Description |
| Tomcat: deploy |
Deploy a web war package |
| Tomcat: reload |
Reload the web war package |
|
Tomcat: start |
Start tomcat |
|
Tomcat: stop |
Stop tomcat |
|
Tomcat: undeploy |
Stop a war package |
| Tomcat: run |
Start embedded tomcat and run the current project |
Tomcat-maven-plugin plug-ins use the same as the tomcat7-maven-plugin plug-ins, as long as<Server> tomcat7 </server><Server> tomcat7 </server>