JaCoCo can not instrument classes which is already instrumented by Jmockit
来源:互联网 发布:吃鸡助手优化软件 编辑:程序博客网 时间:2024/06/03 04:57
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.
- Jmockit seems to instrument classes it need.
- JaCoCo can not instrument classes which is already instrumented by Jmockit and spits out a HUGE amount of exceptions, saying that it's impossible to instrument class, which were already instrumented. However Sonar seems to have a valid output for such a scenario.
So first question is: can I somehow suppress such an exceptions? It is really critical because the size of the log file on our CI system achieves50Mb
(!), 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:
java.lang.instrument.IllegalClassFormatException: Error while instrumenting class app/MyClass.Caused by: java.lang.IllegalStateException: Class app/MyClass is already instrumented.
Assuming that suppression of such an exceptions is impossible I investigated it a little bit and found out that JaCoCo (a tool, which Sonar uses and a tool, which can't instrument already instrumented classes) have such a mode as
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>
不然只能使用
Cobertura 插件,因为jacoco和 mock存在 很多不兼容的地方。
阅读全文
0 0
- JaCoCo can not instrument classes which is already instrumented by Jmockit
- MySQL触发器更新本表数据异常:Can't update table 'tbl' in stored function/trigger because it is already used by statement which invoked this
- Solution for Can’t update table ‘t1′ in stored function/trigger because it is already used by statement which invoked this store
- Can't update table 'tbl' in stored function/trigger because it is already used by statement which invoked this stored function/t
- ERROR 1442 (HY000): Can\'t update table \'sign\' in stored function/trigger because it is already used by statement which invoke
- jmockit jacoco冲突
- 错误it is already used by statement which invoked this stored functiontrigger的解决方法
- which is not very fa
- The archive: /bin/bootstrap.jar which is referenced by the classpath, does not exist.
- The project: project which is referenced by the classpath, does not exist.
- Tomcat配置: The archive: /bin/bootstrap.jar which is referenced by the classpath, does not exist.
- the project:mysql which is referenced by the classpath, does not exist
- The project: sgcc which is referenced by the classpath, does not exist.
- The project: ems which is referenced by the classpath, does not exist.
- Myeclipse报错:The project: XXXX which is referenced by the classpath, does not exist.
- 异常-The project: upload_client1 which is referenced by the classpath, does not exist.
- Eclipse. The archive which is referenced by the classpath, does not exist
- The archive: /bin/bootstrap.jar which is referenced by the classpath, does not exist.
- pulltorefreshdemo 上拉下拉
- 使用pl/sql在oracle中新建表和对应序列
- Java常用的一些工具方法
- 重建二叉树
- Navicat for MySQL出现1030-Got error 28 from storage engine错误
- JaCoCo can not instrument classes which is already instrumented by Jmockit
- 序员要开始学习深度学习,该如何入手?
- 重新安装win7后的java开发环境eclipse and postgresql
- linux长期运行进程的四种方法
- Deadlocked Schedulers 线程池等待故障排除
- 深度学习方法(五):卷积神经网络CNN经典模型整理Lenet,Alexnet,Googlenet,VGG,Deep Residual Learning
- Tablayout和ViewPager关联
- 统计学习方法(七)
- Python requests post提交数据