Ensure the TOMCAT7 configuration is complete. Install M2eclipse plug-in;
Here are the specific ways to use it:
- TOMCAT7 User and Permissions configuration: In the Conf directory, locate Tomcat-users.xml, add Manager permissions to the user. Here I have used the permissions are added to the Admin user, the specific code is as follows:
<role rolename="Admin-gui"/><role rolename="Admin-script"/><role rolename="Manager-gui"/><role rolename="Manager-script"/><role rolename="MANAGER-JMX"/><role rolename="Manager-status"/><user username="Admin"password="Password"roles="Manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>
- Maven Server configuration: Locate the Setting.xml file under the Conf directory in the MAVEN installation path, add the user information configured under TOMCAT7 in the <servers> node (ID can be filled in arbitrarily, But username and password must be consistent with step 1)
<server> <id>tomcat7</id> <username>admin</username> <password >password</password></server>
- In the <plugins> node of the Web project's Pom.xml file, add the TOMCAT7 maven plugin,
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId> tomcat7-maven-plugin</artifactid> <version>2.1</version> <configuration > <!--note the URL here-- <url>http://localhost:8080/manager/text</url> <server>tomcat7</server> <!--The name here must be the same as the ID configured in Setting.xml- <path>/ Mavenproject</path> <!--The name here is the project name-- </configuration></plugin>
Finally, only MVN Tomcat7:redeploy is required (the Tomcat server must be started beforehand)
Run Run Configration
Maven Eclipse TOMCAT7 Integration (2) MAVEN automatically deploys to TOMCAT7