Why does Gradle build fail with java8?

Our Gradle script creates several projects with different initial parameters and targetCompatibility. If my JAVA_HOME environment variables are set to jdk7 all projects build successfully. Then I changed JAVA_HOME to jdk8. Now fail with below errors:

 FATAL ERROR in native method: processing of -javaagent failed
FATAL ERROR in native method: processing of -javaagent failed

ava.lang.VerifyError: Expecting a stackmap frame at branch target 51
    Exception Details:
      Location:
        com/test/Tray.<clinit>()V @42: ifnull
      Reason:
        Expected stackmap frame at this location.
      Bytecode:
        0x0000000: 08bd 0063 5903 1264 5359 0412 6553 5905
        0x0000010: 1266 5359 0612 6753 5907 1268 53b3 006a
        0x0000020: 08bd 006c 5903 00b2 0080 c600 09b2 0080
        0x0000030: a700 0c12 82b8 0084 59b3 0080 0053 5904





java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
        at org.jacoco.agent.rt_6l8m50.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
        at org.jacoco.agent.rt_6l8m50.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:99)
        at org.jacoco.agent.rt_6l8m50.JacocoAgent.createRuntime(JacocoAgent.java:128)
        at org.jacoco.agent.rt_6l8m50.JacocoAgent.init(JacocoAgent.java:74)
        at org.jacoco.agent.rt_6l8m50.JacocoAgent.premain(JacocoAgent.java:165)
        ... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
        at java.lang.Class.getField(Class.java:1703)
        at org.jacoco.agent.rt_6l8m50.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:136)
        ... 10 more
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
Exception in thread "main" Could not write standard input into: Gradle Test Executor 2.
java.io.IOException: The pipe is being closed
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:326)
        at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
        at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:50)
        at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
        at org.jacoco.agent.rt_6l8m50.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
        at org.jacoco.agent.rt_6l8m50.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:99)
        at org.jacoco.agent.rt_6l8m50.JacocoAgent.createRuntime(JacocoAgent.java:128)
        at org.jacoco.agent.rt_6l8m50.JacocoAgent.init(JacocoAgent.java:74)
        at org.jacoco.agent.rt_6l8m50.JacocoAgent.premain(JacocoAgent.java:165)
        ... 6 more

      

Could you please tell me how to fix this problem using java8?

+3


source to share


1 answer


You may need to play with your version of JaCoCo and / or ASM according to this . This is a known issue dating back to 2013. Go to the maven search site, search for the latest versions and push the test dependencies to the most recent available and see if that fixes it.



+1


source







All Articles