1

我有一些Arquillian測試(包括Drone/Graphene測試)的maven項目。缺少Jacoco代碼覆蓋率和IncompatibleClassChangeError

當我建立使用maven使用石墨烯和無人機或經我所有的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與此配置文件jacoc o arq-wildfly

構建失敗,並在我的目標目錄中創建jacoco.exec文件。

如果我刪除目標準備代理在jacoco輪廓和運行相同的MVN指令(清潔套裝-fae)與型材jacoco ARQ-wildfly我所有的測試完成全成,但沒有創造jacoco.exec文件。

我在做什麼錯了?有人有一個使用Arquillian的Drone/Graphene測試和Jacoco代碼覆蓋率的工作示例嗎?

有關我的環境的附加信息:

  • Wildfly 10
  • 的Arquillian核心1.1.11.Final
  • 的Arquillian無人機1.3.1.Final
  • 的Arquillian石墨烯2.1.0.Beta1
  • Arquillian Jacoco 1.0.0.Alpha8
  • Jacoco 0.7.6.201602180812

回答

5

你的類路徑上有多個asm版本,jacoco需要最新版本。

使用mvn dependency:tree找到ASM版本,我覺得你有ASM:ASMorg.ow2.asm: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> 
與該ASM需要依賴以下
相關問題