maven-tomcat-plugin能够方便的部署war应用到本地或远程的tomcat上,废话少说,看代码,下面是带有maven-tomcat-plugin配置的pom.xml
<properties>
<!-- Cargo settings -->
<cargo.container.manager.url>http://192.168.1.107/manager</cargo.container.manager.url>
<cargo.container.username>admin</cargo.container.username>
<cargo.container.password>123456</cargo.container.password>
<cargo.wait>false</cargo.wait>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-beta-1</version>
<configuration>
<path>/runes</path>
<url>${cargo.container.manager.url}</url>
<username>${cargo.container.username}</username>
<password>${cargo.container.password}</password>
<warDirectory>${basedir}/src/main/webapp</warDirectory>
</configuration>
<executions>
<execution>
<id>tomcat-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<!--execution>
<id>undeploy</id>
<phase>deploy</phase>
<goals>
<goal>start</goal>
</goals>
</execution-->
</executions>
</plugin>
</plugins>
</build>
maven-tomcat-plugin通过tomcat的manager控制台来deploy或undeploy应用,所以要把你的tomcat的相关信息配置上,包括manager url,用户名及密码等!