Maven Cargo Tomcat 部署
pom.xml中<build>下添加如下代码:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>0.3</version>
<configuration>
<wait>${cargo.wait}</wait>
<container>
<containerId>${cargo.container}</containerId>
<type>installed</type>
<home>${env.CATALINA_HOME}</home>
</container>
<configuration>
<home>${project.build.directory}/${cargo.container}/container</home>
<properties>
<cargo.hostname>${cargo.host}</cargo.hostname>
<cargo.servlet.port>${cargo.port}</cargo.servlet.port>
</properties>
</configuration>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</build>
各参数如下设置,应该添加在<properties>中:
<cargo.container>tomcat5x</cargo.container>
<cargo.container.home>${env.CATALINA_HOME}</cargo.container.home>
<cargo.host>localhost</cargo.host>
<cargo.port>8081</cargo.port>
<cargo.wait>true</cargo.wait>
运行:mvn:install