I have a maven project with some Arquillian Tests (Drone/Graphene Tests included).
When I build my project using maven all my Arquillian Tests that use Graphene and Drone or Warp will fail with following exception
Running de.mmo.arq.model.diverses.stammdaten.geldinstitut.GeldinstitutBlzTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.862 sec <<< FAILURE! - in de.mmo.arq.model.diverses.stammdaten.geldinstitut.GeldinstitutBlzTest
de.mmo.arq.model.diverses.stammdaten.geldinstitut.GeldinstitutBlzTest Time elapsed: 4.862 sec <<< ERROR!
org.jboss.shrinkwrap.api.exporter.ArchiveExportException: Failed to write asset to output: /WEB-INF/classes/de/mmo/base/dao/CrudService.class
Caused by: java.lang.IncompatibleClassChangeError: class org.jacoco.core.internal.flow.ClassProbesVisitor has interface org.objectweb.asm.ClassVisitor as super class
This is the place where the magic should happen
<build>
<finalName>browser</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<tagBase>...</tagBase>
<useReleaseProfile>false</useReleaseProfile>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>jacoco</id>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>arq-wildfly</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire}</version>
<configuration>
<skipTests>false</skipTests>
<systemPropertyVariables>
<arquillian.launch>wildfly-remote</arquillian.launch>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire}</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${wildfly.maven-plugin}</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>
I'm using mvn to build my project with this goals clean package -fae with this profiles jacoco arq-wildfly
The build fails and the jacoco.exec file is created at my target directory.
If I remove the goal prepare-agent in the jacoco profile and run the same mvn command (clean package -fae) with the profiles jacoco arq-wildfly all my tests finish successfull but without creating the jacoco.exec file.
What I'm doing wrong? Does someone have a working example using Arquillian with Drone/Graphene Tests and Jacoco for code coverage?
For additional information about my environment:
You have a multiple asm versions on your classpath, jacoco needs the most recent one.
Use mvn dependency:tree
to find the asm versions, I think you have asm:asm and org.ow2.asm:asm-debug-all in your dependencies.
Exclude the old version (asm:asm) with the following for the dependency which needs asm:
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>asm</groupId>
</exclusion>
</exclusions>
</dependency>
For drone it would be something like this:
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>graphene-webdriver</artifactId>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>asm</groupId>
</exclusion>
</exclusions>
</dependency>