The MAVEN plug-in for Tomcat helps improve development efficiency because:
--You can publish the project directly to a remote server.
--ability to implement thermal deployment of the project, modify Java classes during development, no need to restart Tomcat
First, configure a Tomcat Admin user
1. Modify the Tomcat root path under Conf/tomcat-users.xml to add User Configuration to Tomcat
< role rolename = "Manager-gui" Span style= "color: #0000ff;" >/> < role rolename = "Manager-script" /> < user username = "admin" password = "admin" roles = "Manager-gui,manager-script" />
Start Tomcat
Enter the value above with the username and password to enter the application management interface
Here we can manage the projects posted to Tomcat
2. You need to configure Tomcat's Maven plugin in the Pom.xml file for the MAVEN project: Tomcat7-maven-plugin, in the Pom.xml configuration file:
<Build> <Finalname>Taotao</Finalname> <Plugins> <plugin> <groupId>Org.apache.tomcat.maven</groupId> <Artifactid>Tomcat7-maven-plugin</Artifactid> <version>2.2</version> <Configuration> <URL>http://localhost:8080/manager/text</URL> <!--Configure the path for Tomcat - <username>Admin</username> <Password>Admin</Password> <uriencoding>UTF-8</uriencoding> <!--Tomcat URL encoding to achieve and modify the same functionality as the Server.xml file - </Configuration> </plugin> </Plugins></Build>
3. Start Tomcat
Select your Web project in working directory,
In command line, fill in the commands you need.
Tomcat7:deploy publishing a project to a remote server
Tomcat7:run running Tomcat default port is 8080 already supported for hot deployment
Maven Tomcat plug-in for hot deployment