1.軟件版本html
apache-tomcat-7.0.55apache
apache-maven-3.2.2tomcat
eclipse-standard-luna-R-win32-x86_64eclipse
2.修改文件maven
2.1 tomcat tomcat-users.xmlui
增長以下用戶 角色 manager-scriptthis
manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the "Server Status" page.url
<role rolename="manager-script"/> <role rolename="manager-gui"/> <role rolename="admin-gui"/> <user username="admin" password="admin" roles="manager-script"/>
參考文檔 spa
http://127.0.0.1:8080/docs/manager-howto.html#Configuring_Manager_Application_Access code
2.2 maven setting.xml
servers 裏添加
<server> <id>tomcat7</id> <username>admin</username> <password>admin</password> </server>
2.3 項目 pom.xml
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.0-beta-1</version> <configuration> <url>http://localhost:8080/manager/text</url> <server>tomcat7</server> <username>admin</username> <password>admin</password> </configuration> </plugin>
注:此處的server 裏面的tomcat7 要與上2.2maven 配置文件setting.xml 裏server id 一致
maven 命令:tomcat7:deploy
以下圖