1添加tomcat用戶,在conf/tomcat-user.xml文件下添加一個tomcat用戶
<role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="tomcat" password="123456" roles="manager-gui, manager-script"/>
啟動tomcat后,可以進入后台

2在Maven項目pom.xml中配置tomcat7的插件
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<username>tomcat</username>
<password>123456</password>
</configuration>
</plugin>
3項目右鍵,run as


如果項目已經存在,則用tomcat7:redeploy命令
