I have not been able to get a successful Maven pom.xml configuration to start JBoss AS 7, deploy a war artifact, and have it wait until the artifact has been successfully deployed before starting to run integration tests.
I've already consulted...
- http://navinpeiris.com/tag/jboss-as-7/
- http://cargo.codehaus.org/Maven2+Plugin+Reference+Guide#Maven2PluginReferenceGuide-deployer
I want to use an installed (and pre-configured) JBoss AS 7 container. I do not want to have it up-and-running all the time. I want to start it, run some tests, and shut it down.
My environment:
- cargo-maven2-plugin 1.3.1
- jboss-as-7.1.1.Final
- maven-failsafe-plugin 2.12.4
Here's what I have for Failsafe
config...
<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>
Here's what I have for Cargo
config...
<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>
The above config works great when I want to manually startup the container with mvn clean package cargo:run
. But it does not achieve the desired effect during CI builds with mvn clean integration-test
.
Hints? Suggestions welcomed.