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命令