利用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包