利用maven的插件和tomcat自身提供的部署功能来实现远程部署。 shell
首先在pom文件里设置插件: tomcat
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <configuration> <url>http://localhost:8080/manager</url> <server>testMVN</server> <path>/mycontext</path> </configuration> </plugin>
而后在maven的settings.xml里配置 maven
<servers> <server> <id>testMVN</id> <username>marshal</username> <password>password</password> </server> </servers>
1.mvn tomcat:deploy. 发布 (若是已经存在则发布不了)
2.mvn tomcat:redeploy. 从新发布 (会替换已存在的项目)
3.mvn tomcat:undeploy 撤销部署 4.mvn tomcat:start 启动项目 5.mvn tomcat:stop 中止项目 6.mvn war:exploded tomcat:exploded 展开war包