Skip to content

Instantly share code, notes, and snippets.

@ioggstream
Created November 27, 2014 15:17
Show Gist options
  • Save ioggstream/7d6eb03bde8bfce378d5 to your computer and use it in GitHub Desktop.
Save ioggstream/7d6eb03bde8bfce378d5 to your computer and use it in GitHub Desktop.
arquillian-maven-profiles.xml
<!-- Those profiles enables arquillian integration tests under
* src/it/java
* src/it/resources
To run them, use eg.
# mvn -Darquillian=true -Parq-eap6-managed
They rely on src/it/resources/arquillian.xml containing the
container qualifiers named:
* eap6-managed
* eap6-remote
-->
<!-- Profiles for Arquilian integration tests -->
<profiles>
<profile>
<id>arq-base</id>
<activation>
<property>
<name>arquillian</name>
<value>true</value>
</property>
</activation>
<dependencyManagement>
<dependencies>
<!-- Integration Testing -->
<!-- Load Arquillian BOM and its dependencies: this could even go in
the parent pom. -->
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.5.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Integration testing -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<!-- Arquillian Maven dependency resolver -->
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<scope>test</scope>
<type>pom</type>
</dependency>
</dependencies>
<build>
<testResources>
<!-- Load mvn properties into arquillian.xml which is in src/it/resources -->
<testResource>
<directory>src/it/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Run integration tests from src/it/java -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-test-amsource</id>
<!-- This will help m2eclipse to recognize the folder as source folder
after update project configuration. -->
<phase>process-resources</phase>
<!-- <phase>generate-test-sources</phase> -->
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/it/java</source>
<source>src/it/resources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- Profile for running arquillian tests on a remote container configured
in arquillian.xml -->
<id>arq-eap6-remote</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<version>7.1.1.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- Select the arquillian container by-profile -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<arquillian.launch>eap6-remote</arquillian.launch>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- Managed jboss container that should be provided: * by the maven-dependency-plugin
* in the directory configured in arquillian.xml Server startup configuration
is defined in arquillian.xml -->
<id>arq-eap6-managed</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<version>7.1.1.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- As maven uses the failsafe plugin for running integration tests
we must set the arquillian.launch property here. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<arquillian.launch>eap6-managed</arquillian.launch>
</systemPropertyVariables>
</configuration>
</plugin>
<!-- Download and unpack the given jboss distribution from the internet.
IMPORTANT: Red Hat provides the JBoss zip files via the given repository,
to be added to your settings.xml.
As per http://jbossas.jboss.org/faq it
is fine to use the 6.x.0.Alpha "The first EAP stage Alpha is of equivalent,
or better, quality to a community Final release"
@link http://maven.repository.redhat.com/techpreview/eap6/6.3.0.Alpha/maven-repository/
To use different versions of JBoss, browse from there and search for the
artifact in org.jboss.as/jboss-as-dist: @link http://maven.repository.redhat.com/techpreview/eap6/
Remembed that the jbossas version (eg. 7.4.0) is different from the EAP version(eg.
6.3.0). -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>7.4.0.Final-redhat-4</version> <!-- This value can go in a property -->
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment