我有一个带有一些Arquillian测试(包括Drone / Graphene测试)的Maven项目。
当我使用Maven构建项目时,所有使用Graphene和Drone或Warp的Arquillian测试都将失败,并出现以下异常
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
这是发生魔法的地方
<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>
我正在使用mvn使用此目标干净包-fae使用此配置文件jacoco arq-wildfly构建我的项目
构建失败,并且在我的目标目录中创建了jacoco.exec文件。
如果我删除了jacoco配置文件中的目标prepare-agent并使用配置文件jacoco arq-wildfly运行相同的mvn命令(干净软件包-fae),则所有测试均成功完成,但未创建jacoco.exec文件。
我做错了什么?有人有使用Arquillian与Drone / Graphene Tests和Jacoco进行代码覆盖的工作示例吗?
有关我的环境的其他信息:
野蝇10
Arquillian Core 1.1.11。最终版
Arquillian Drone 1.3.1.Final
Arquillian石墨烯2.1.0.Beta1
Arquillian Jacoco 1.0.0.Alpha8
哈科科0.7.6.201602180812
参考方案
您的类路径上有多个asm版本,jacoco需要最新版本。
使用mvn dependency:tree
查找asm版本,我认为您的依赖项中包含asm:asm和org.ow2.asm:asm-debug-all。
对于需要asm的依赖项,请使用以下内容排除旧版本(asm:asm):
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>asm</groupId>
</exclusion>
</exclusions>
</dependency>
对于无人机,它是这样的:
<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>
Maven:从jar工件中排除生成的源 - javaDuplicate,但没有答案,无法评论背景信息:我有一个模块,该模块使用xmlbeans-maven-plugin从xsd生成Java源文件并将其编译到其自己的jar中。这可以正常工作,并使用Java源代码创建一个module1 / target / generated-sources文件夹。该模块已构建,但生成的源包含在jar中,这是不必要的,因为xml…
休眠映射<键,设置<值>> - java我有以下表格:@Entity @Table(name = "events") Event --id --name @Entity @Table(name = "state") State --id --name @Entity @Table(name = "action") Action --id …
通过Maven编译器插件不会发生有限的包含和排除 - java我正在使用3.6.0版的maven编译器插件,在此我们只想在特定文件夹中编译一个文件,而在该位置编译所有其他文件。例如:在文件夹应用程序中有14个文件,从那我只希望编译1个文件,但它编译了所有文件,如果我要排除,则它也不起作用。 <sourceDirectory>${basedir}/../src/java</sourceDirectory…
无法从ArrayList <String>转换为List <Comparable> - java当我写下面的代码时,编译器说 无法从ArrayList<String>转换为List<Comparable>private List<Comparable> get(){ return new ArrayList<String>(); } 但是当我用通配符编写返回类型时,代码会编译。private List&l…
合并List <T>和List <Optional <T >> - java鉴于: List<Integer> integers = new ArrayList<>(Arrays.asList( 10, 12 )); List<Optional<Integer>> optionalIntegers = Arrays.asList( Optional.of(5), Optional.em…