1.在 pom.xml
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <url>http://192.168.18.253:8080/manager/text</url> <username>admin</username> <password>admin</password> <server><span style="color:#ff0000;">tomcat7</span></server> <path>/junly-jee</path> </configuration> <executions> <execution> <id>tomcat-deploy</id> <phase>deploy</phase> <goals> <goal>deploy</goal> </goals> </execution> </executions> </plugin>
2 . 在Tomcat的tomcat-users.xml里添加下面的信息
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="admin" password="admin" roles="manager-gui,manager-script"/>
3. 启动Tomcat
(这个很重要)
不启动tomcat 会报 Cannot invoke Tomcat manager: Connection refused: connect ->
4.
在Eclipse运行Maven build...
4. 在Eclipse运行Maven
build...
在Goals后输入:
tomcat7:deploy
注意标红的地方。