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
以下图