JaCoCo plugin fails with class loading error when run with 1.10.0-SNAPSHOT
See original GitHub issueDescribe the bug
I’m trying to upgrade my plugin to work with the 2022.3 EAP.
To do this, I first am upgrading my build to use the snapshot of the intellij plugin, 1.10.0-SNAPSHOT as advised on the [website] (https://plugins.jetbrains.com/docs/intellij/configuring-plugin-project.html#target-platform-and-dependencies).
Unfortunately, when I do this I get a strange error from the jacoco plugin that is also configured in my build:
OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "com.intellij.util.lang.PathClassLoader"). To use archived non-system classes, this property must not be set
CompileCommand: exclude com/intellij/openapi/vfs/impl/FilePartNodeRoot.trieDescend bool exclude = true
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.jacoco.agent.rt.internal_f3994fa.core.runtime.InjectedClassRuntime$Lookup.defineClass(InjectedClassRuntime.java:134)
at org.jacoco.agent.rt.internal_f3994fa.core.runtime.InjectedClassRuntime.startup(InjectedClassRuntime.java:54)
at org.jacoco.agent.rt.internal_f3994fa.PreMain.premain(PreMain.java:53)
... 6 more
Caused by: java.lang.LinkageError: loader 'bootstrap' attempted duplicate class definition for java.lang.$JaCoCo. (java.lang.$JaCoCo is in module java.base of loader 'bootstrap')
at java.base/java.lang.ClassLoader.defineClass0(Native Method)
at java.base/java.lang.System$2.defineClass(System.java:2307)
at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2439)
at java.base/java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2416)
at java.base/java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:1843)
java.lang.instrument ASSERTION FAILED: "result" with message agent load/premain call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
AFAIK there is only 1 jacoco dependency being referenced by my gradle build and even if I remove it completely I still get this error.
To Reproduce
Include the IJ plugin version 1.10.0-SNAPSHOT and the jacoco plugin in build.gradle
Run: ./gradlew build
Version of Jacoco used:
jacoco { toolVersion = "0.8.6" }
Expected behavior JaCoCo should produce coverage reports without error.
Environment:
- OS: linux
- Gradle IntelliJ Plugin Version: 1.10.0-SNAPSHOT
- Gradle Version : 7.4.2
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Related StackOverflow Question
Please verify this issue with the latest snapshot.
@hsz I can confirm I no longer get this error when enabling the plugin, thanks!