Intellij IDEA代码覆盖率无效 [英] Intellij IDEA code coverage doesn't work

查看:621
本文介绍了Intellij IDEA代码覆盖率无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在覆盖范围内运行JUnit测试时,出现以下错误

When I'm trying to run my JUnit tests with coverage I receive the following error

FATAL ERROR in native method: processing of -javaagent failed
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)
    at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.coverage.main.CoveragePremain.premain(CoveragePremain.java:50)
    ... 6 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at com.intellij.rt.coverage.instrumentation.Instrumentator.premain(Instrumentator.java:40)
    ... 11 more
Exception in thread "main" 
Process finished with exit code 1

有人可以帮助修复它吗?

Can anybody help to fix it?

推荐答案

在这里看看: https://youtrack.jetbrains.com/issue/IDEABKL-5941

您可以将-Djava.io.tmpdir参数添加到idea的启动脚本中,或替换TMP系统属性.

You can add -Djava.io.tmpdir param to idea's launching script or replace TMP system property.

也许您还必须在安装目录中的idea.properties中更改idea.config.path和idea.system.path.

Also probably you will have to change idea.config.path and idea.system.path in idea.properties in installation directory.

这篇关于Intellij IDEA代码覆盖率无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆