maven使用jacoco遇到的一个问题

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

[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 numbermaven

... ...ide

[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信息就行了spa

<plugin>hibernate

<groupId>org.jacoco</groupId>代理

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

<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>

相关文章
相关标签/搜索