I have a multi-project Gradle v1.8 build that applies the jacoco plugin to one of the subprojects:
apply plugin: 'jacoco'
When I build from the top-level directory of the parent project, I see a lot of stack traces indicating something failing:
:common:page-object-core:test
Exception in thread "main" FATAL ERROR in native method: processing of -javaagent failed
java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_5d10cad.PreMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:280)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Could not write standard input into: Gradle Worker 2.
java.io.IOException: Broken pipe
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:282)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:50)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Exception in thread "main" java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_5d10cad.PreMain
FATAL ERROR in native method: processing of -javaagent failed
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:280)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Could not write standard input into: Gradle Worker 3.
java.io.IOException: Broken pipe
...
But when I go into the subproject directory and build there, I see no such error.
$ ./gradlew clean build
:clean UP-TO-DATE
:proj1:clean UP-TO-DATE
:proj2:clean UP-TO-DATE
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
:proj1:compileJava
:proj1:processResources UP-TO-DATE
:proj1:classes
:proj1:jar
:proj1:assemble
:proj1:compileTestJava
:proj1:processTestResources UP-TO-DATE
:proj1:testClasses
:proj1:test
Exception in thread "main" FATAL ERROR in native method: processing of -javaagent failed
java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_5d10cad.PreMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:280)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Could not write standard input into: Gradle Worker 1.
java.io.IOException: Broken pipe
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:282)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:50)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
:proj1:test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':proj1:test'.
> Process 'Gradle Worker 1' finished with non-zero exit value 134
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.948 secs
But from proj1/, to which jacoco plugin has been applied, this does not fail:
Looks like you have stumbled upon GRADLE-2859, which is caused by GRADLE-2860. I had the same problem with my integ tests. The following fixed it for me:
but found that the jacoco failure still obtains. I have a 25-submodule build. I’d like to centralize this in one place, rather than maintain it for all test/intTest tasks explicity.