Transferred from http://blog.csdn.net/lanhaimylover/article/details/7794476
Multiple verification, to adjust <</span>url>http://localhost:8080/manager/html</</span>url> to http://localhost : 8080/manager/text.
Multi-search so that the MAVEN project can be automatically released to Tomcat.
TOMCAT7 needs to use a new version of Tomcat-maven-plugin, version support TOMCAT6 and Tomcat7,groupid are also changed from Org.codehaus.mojo to Org.apache.tomcat.maven. can refer to see: http://tomcat.apache.org/maven-plugin.html
The main course is coming.
1. Modify the pom.xml of the project
A. Add the Tomcat-maven-plugin plug-in information under the project node, and add the Tomcat6 and Tomcat7 Plug-ins as follows, such as using only 1 types to write only one
<pluginManagement> <plugins> <plugin> <groupid>org.apache.tomcat. Maven</groupid> <artifactId>tomcat6-maven-plugin</artifactId> <version& Gt;2.0</version> <configuration> <url>http://localhost:8080/manager
/html</url> <server>tomcat</server> </configuration>
</plugin> <plugin> <groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId> <version>2.0</version>
<configuration> <url>http://localhost:8080/manager/html</url> <server>tomcat</server> <username>admin</username> <pass Word>admin</password> </configuration> </plugin> </plugins> </pluginManagement>
--html can be replaced with text, this must be changed to text, otherwise reported 403.
B. Under the project node, add warehouse information to ensure that Maven can download from the warehouse to the Tomcat-maven-plugin plug-in, less add this information, did not download to plug-ins, resulting in errors, wasted a lot of time.
Online posts said to add the following two paragraphs of information, individuals suspected that only need to add 1 paragraphs.
<repository>
<id>people.apache.snapshots</id>
<url>
http:// repository.apache.org/content/groups/snapshots-group/
</url>
<releases>
<enabled >false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<pluginRepository>
<id>apache.snapshots</id>
<name>apache snapshots</name >
<url>
http://repository.apache.org/content/groups/snapshots-group/
</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
< enabled>true</enabled>
</snapshots>
</pluginRepository>
2. Configure Setting.xml,%maven_home%\conf\setting.xml (provided that the MyEclipse In preferences, MAVEN enables the Local install version and sets the user setting.xml to the Setting.xml under the local conf, instead of the plugin, the plugin should be "My Documents" \.m2\setting.xml),
Add in Label
<server>
<id>tomcat</id>
<username>admin</username>
<password >admin</password>
The ID is the same as the Pom.xml file configuration, and the username password is the same as Tomcat_user.
This part of the configuration can also be written in the Pox.xml
3. Configure users for TOMCAT,%tomcat_home%\conf\tomcat_user.xml add the following roles and users for Tomcat_maven_plugin automatic deployment project
<role rolename= "Manager-gui"/> <role rolename= "Manager-script"/> <user
"admin" password= "admin" roles= "Manager-gui, Manager-script"/>
4. Start Tomcat, right-click on project or pom.xml, enter command Tomcat7:deploy in goals of MAVEN build, or create a new command on run Configurations->maven build. Choose your Web project in base directory and fill in the commands you need in the Goals column.
The commands used in goals can refer to the http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/tomcat7-maven-plugin/plugin-info.html
Reference Links:
Http://hi.baidu.com/xikan/blog/item/66547fedb13201f5b21cb120.html
http://vivus.iteye.com/blog/1561664