2012-01-11 63 views

回答

0

这应该是足够的(指定端口是可选的,更改URL,以获取不同版本tomcat7的):

 <plugin> 
    <groupId>org.codehaus.cargo</groupId> 
    <artifactId>cargo-maven2-plugin</artifactId> 
    <version>1.2.0</version> 
    <!-- minimal configuration to let adb run (mvn package org.codehaus.cargo:cargo-maven2-plugin:run) in a local tomcat --> 
    <configuration> 
     <container> 
     <containerId>tomcat7x</containerId> 
     <zipUrlInstaller> 
      <url>http://a-inet01:8100/apache-tomcat-7.0.25.zip</url> 
     </zipUrlInstaller> 
     </container> 
     <configuration> 
     <properties> 
      <cargo.servlet.port>1718</cargo.servlet.port> 
     </properties> 
     </configuration> 
    </configuration> 
    </plugin> 

比MVN包org.codehaus.cargo:货物maven2的-插件:运行(在包装“战争”的mavenproject)将创建战争,从给定的网址下载tomcat,启动它并部署战争。如果你使用启动容器如果Maven是结束(这一个U将在集成测试使用)停止: 如果你想比补自动启动货物:

  <plugin> 
      <groupId>org.codehaus.cargo</groupId> 
      <artifactId>cargo-maven2-plugin</artifactId> 
      <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> 
      <configuration> 
       [Cargo plugin configuration goes in here] 
      </configuration> 
     </plugin> 

从货物行家实况(HTTP只是复制: //cargo.codehaus.org/Starting+and+stopping+a+container)。这将在“集成测试”之前启动容器,并在测试之后停止。

+0

这是他们所说的“嵌入式”吗?我有一个类似的问题在http://stackoverflow.com/questions/13701562/cargo-plugin-the-deployable-state-is-unknown没有采取。我见过提到tomcat不支持embedded。 – MikeW 2012-12-05 20:59:25