maven-tomcat-plugin能夠方便的部署war應用到本地或遠程的tomcat上,廢話 少說,看代碼,下面是帶有maven-tomcat-plugin配置的pom.xml
<properties>
<!-- Cargo settings -->
<cargo.container.manager.url>http://192.168.1.107/manager</ca rgo.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,用戶名及密碼等!