Maven Cargo JBoss
Setting up JBoss
It is a good practice to startup JBoss outside the scope of maven and use cargo to redeploy your app. To setup JBoss 4, download the binary, go to the bin directory and run run.sh. The default host/port is localhost:8080, which is also the default of the following maven cargo configuration.
Example configuration which works with JBoss 4x and Maven2
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>jboss4x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
</configuration>
</configuration>
</plugin>
To deploy, simply type:
mvn cargo:redeploy
Cargo uses the jmx-console over http to deploy and no file path configuration is needed! This only works with JBoss running locally as a file: reference to the war file is passed over http.
Create a selenium profile to automatically test your application during the integration-test phase
<profile>
<id>selenium</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>jboss4x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
</configuration>
<deployer>
<type>remote</type>
<deployables>
<deployable>
<properties>
<!-- due to bug in jboss4 deployer, can't change context -->
<context>/${project.context}</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
<executions>
<execution>
<id>deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>undeploy</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<configuration>
<browser>*firefox</browser>
<suite>src/test/selenium/suite.html</suite>
<startURL>http://${cargo.host}:${cargo.port}</startURL>
<xauthEnabled>false</xauthEnabled>
<results>target/selenium/suite-results.html</results>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>integration-test</phase>
<goals>
<goal>selenese</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Related posts:

Maven Cargo JBoss | Vineet Manohar’s blogthank you for share
very nice great post