我无法获得成功的 Maven pom.xml 配置来启动 JBoss AS 7、部署战争工件,并让它等到工件成功部署后再开始运行集成测试。
我已经咨询过了...
- http://navinpeiris.com/tag/jboss-as-7/
- http://cargo.codehaus.org/Maven2+Plugin+Reference+Guide#Maven2PluginReferenceGuide-deployer
我想使用已安装(和预配置)的 JBoss AS 7 容器。我不想让它一直运行。我想启动它,运行一些测试,然后关闭它。
我的环境:
- cargo-maven2-plugin 1.3.1
- jboss-as-7.1.1.Final
- maven-failsafe-plugin 2.12.4
这是我的Failsafe
配置...
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<configuration>
<forkMode>once</forkMode>
<argLine>-javaagent:"${settings.localRepository}/org/springframework/spring-instrument/${spring.framework.version}/spring-instrument-${spring.framework.version}.jar"</argLine>
<useSystemClassLoader>true</useSystemClassLoader>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<!-- Uncomment the line below if you want the build to fail when any integration test fails -->
<!-- <goal>verify</goal> -->
</goals>
</execution>
</executions>
</plugin>
这是我的Cargo
配置...
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${cargo-maven2-plugin.version}</version>
<configuration>
<container>
<containerId>jboss71x</containerId>
<type>installed</type>
<home>${jboss71x.home}</home>
<output>${project.build.directory}/jboss71x/container.log</output>
<append>false</append>
<log>${project.build.directory}/jboss71x/cargo.log</log>
</container>
<configuration>
<type>standalone</type>
<home>${project.build.directory}/jboss71x/container</home>
<properties>
<cargo.jboss.configuration>default</cargo.jboss.configuration>
<cargo.rmi.port>1099</cargo.rmi.port>
<cargo.jvmargs>${servlet.container.jvmargs}</cargo.jvmargs>
<cargo.logging>high</cargo.logging>
<cargo.servlet.port>8080</cargo.servlet.port>
</properties>
</configuration>
<deployer>
<type>installed</type>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<properties>
<context>/ws</context>
</properties>
<pingURL>http://localhost:8080/ws/services</pingURL>
<pingTimeout>30000</pingTimeout>
</deployable>
</deployables>
</deployer>
</configuration>
<!-- http://navinpeiris.com/2011/08/22/running-integrationacceptance-tests-in-jboss-7-using-cargo/ -->
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
当我想手动启动容器时,上面的配置效果很好mvn clean package cargo:run
。但是在使用mvn clean integration-test
.
提示?欢迎提出建议。