maven使用jacoco遇到的一个问题

项目使用SSH框架,使用jacoco收集单元测试覆盖率,遇到如下问题:

[ERROR][org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer][Line:165] Javassist Enhancement failed: xxx

java.lang.VerifyError: (class: xxx_$$_javassist_4, method: <clinit> signature: ()V) Illegal local variable number

... ...

[WARN][org.hibernate.tuple.entity.PojoEntityTuplizer][Line:200] could not create proxy factory for:

org.hibernate.HibernateException: Javassist Enhancement failed


原因是jacoco会instrument hibernate生成的代理类,在jacoco的plugin中配置exclude信息就好了

<plugin>

<groupId>org.jacoco</groupId>

<artifactId>jacoco-maven-plugin</artifactId>

<version>0.6.3.201306030806</version>

<executions>

<execution>

<id>JaCoCo Agent</id>

<phase>test-compile</phase>

<goals>

<goal>prepare-agent</goal>

</goals>

<configuration>  

           <excludes>

<exclude>com/**/*_javassist_*</exclude>

           </excludes>  

       </configuration>

</execution>

<execution>

<id>JaCoCo Report</id>

<phase>test</phase>

<goals>

<goal>report</goal>

</goals>

</execution>

</executions>

</plugin>


你可能感兴趣的:(maven,JaCoco)