Gradle fails with VerifyError: Incompatible argument to function


(Robert) #1

Hi,

I have a Gradle 4.4.1 script which occasionally fails. This happens on multiple machines, usually before running the test task. I also tried Gradle 4.5, which results in the same issue.

Here’s the relevant log (acquired while running gradlew test --info):

Up-to-date check for task ':test' took 4.191 secs. It is not up-to-date because:
  No history is available.
(class: org/gradle/process/internal/worker/child/WorkerProcessClassPathProvider$CacheInitializer, method: remapClass signature: (Ljava/lang/Class;Ljava/util/zip/ZipOutputStream;)V) Incompatible argument to function
java.lang.VerifyError: (class: org/gradle/process/internal/worker/child/WorkerProcessClassPathProvider$CacheInitializer, method: remapClass signature: (Ljava/lang/Class;Ljava/util/zip/ZipOutputStream;)V) Incompatible argument to function
    at org.gradle.process.internal.worker.child.WorkerProcessClassPathProvider.findClassPath(WorkerProcessClassPathProvider.java:79)
    at org.gradle.api.internal.DefaultClassPathRegistry.getClassPath(DefaultClassPathRegistry.java:34)
    at org.gradle.process.internal.worker.child.ApplicationClassesInSystemClassLoaderWorkerImplementationFactory.prepareJavaCommand(ApplicationClassesInSystemClassLoaderWorkerImplementationFactory.java:89)
    at org.gradle.process.internal.worker.DefaultWorkerProcessBuilder.build(DefaultWorkerProcessBuilder.java:194)
    at org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor.forkProcess(ForkingTestClassProcessor.java:84)
    at org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor.processTestClass(ForkingTestClassProcessor.java:69)
    at org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor.processTestClass(RestartEveryNTestClassProcessor.java:47)
    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:498)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.dispatch.FailureHandlingDispatch.dispatch(FailureHandlingDispatch.java:29)
    at org.gradle.internal.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:133)
    at org.gradle.internal.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:34)
    at org.gradle.internal.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:73)
    at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)

This example happened on a freshly set up machine, i.e. Gradle downloaded all required stuff just before. If haven’t found anything about this bug on the internet, so any hints on how to fix it are appreciated.

Does anyone have an idea?

Thanks and best regards,

Robert


(Benjamin Muschko) #2

Can you please provide a sample project that reproduces the issue?


(Robert) #3

I was able to fix it.

The problem seemed to be Eclipselink weaving, I had this in my build.gradle:

compileTestJava.doLast {
    ClassLoader antClassLoader = org.apache.tools.ant.Project.class.classLoader
    sourceSets.main.compileClasspath.each{File f -> antClassLoader.addURL(f.toURI().toURL())}

    ant.taskdef(name: "weave",
        classname: "org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask",
        classpath: configurations.compile.asPath
    )

    ant.weave(source: compileJava.destinationDir,
        target: compileJava.destinationDir,
        persistenceinfo: processResources.destinationDir 
    )
}

After removing this part the problem is gone.