Here are the exceptions I've got:
java.lang.instrument.IllegalClassFormatException: Error while instrumenting class app/MyClass.
Caused by: java.lang.IllegalStateException: Class app/MyClass is already instrumented.
本文探讨了Sonar 3.5结合JaCoCo进行代码覆盖率分析时遇到的问题,特别是JaCoCo与JMockit同时使用导致的类文件重复Instrument异常。文中提供了通过配置Maven JaCoCo插件来解决此问题的方法。
Here is what I have:
1) Sonar 3.5 which uses JaCoCo as coverage tool.
2) Jmockit lib to perform testing with use of mocks.
3) Build process automized with maven.
50Mb (!),
which is not acceptable. A lot of free space is just eaten up by such a logs on our CI machine.|
Here are the exceptions I've got:
|
offline
instrumentation (AFAIK Sonar neither support this offline
instrumentation or can suppress such a warnings). This thing is designed to be used exactly for such a cases. So I tried to set up JaCoCo as a
plugin in maven, but I failed to do this cause JaCoCo can't find some execution file. When I'm running mvn
clean install the following error pops up:
[INFO] --- jacoco-maven-plugin:0.6.2.201302030002:report (report) @ webservice-mws ---
[INFO]
Skipping JaCoCo execution due to missing execution data file
解决方法:
在jacoco 中添加:
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<configuration>
<excludes>
<exclude>com.cloud.generated.*</exclude>
</excludes>
<skip>${jacoco.skip.instrument}</skip>
</configuration>
<executions>
<execution>
<id>default-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>default-restore-instrumented-classes</id>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
3148
719
1193