Intellij IDEA代码覆盖率不起作用

时间:2014-01-03 15:30:39

标签: java junit intellij-idea code-coverage

当我尝试使用coverage运行JUnit测试时,我收到以下错误

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

任何人都可以帮忙修复它吗?

1 个答案:

答案 0 :(得分:2)

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

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

也可能你必须在安装目录中的idea.properties中更改idea.config.path和idea.system.path。