Error opening jacocoagent.jar due to long path to


When ‘jacoco’ plugin is applied for all subproject in my multiproject build

subprojects { apply plugin: 'jacoco' }

‘gradle test’ failed with the error like this one:
Error opening zip file or JAR manifest missing : …/…/build/components/
Error occurred during initialization of VM
agent library failed to init: instrument
Could not write standard input into: Gradle Test Executor 2. The pipe is being closed
at Method)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(
at org.gradle.internal.concurrent.StoppableExecutorImpl$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘’.

Process Gradle Test Executor 2 finished with non-zero exit value 1

I’ve found that Gradle starts ‘Gradle Test Executor’ processes using commands like this one:

java.exe -javaagent:…/…/build/components/…/…/build/components/,append=true,inclnolocationclasses=false,dumponexit=true,output=file,jmx=false -Xms256m -Xmx1024m -Dfile.encoding=windows-1251 -Duser.language=en -Duser.variant -ea -cp C:\Users\Vital_Lobachevskij.gradle\caches\2.14\workerMain\gradle-worker.jar ‘Gradle Test Executor 2’

It works in the same way for all subprojects. But, if the subproject name is rather long, e.g. ‘’, Gradle can’t open jacocoagent.jar. On my local, full path to this jar for ‘’ is d:\Projects.…\build\components\\tmp\expandedArchives\org.jacoco.agent-\jacocoagent.jar (179 chars) and the error is thrown.
If I move project folder to the root of disk D, the full path will be shorter (156 chars) and unit tests are passed successfully and code coverage is generated.

I didn’t find any length limitation for ‘javaagent’ parameter. Maybe, the path is loaded into a fixed length buffer inside the plugin.

I don’t see any good workaround right now except excluding some subprojects if length of the path to the jar exceeds a hardcoded limit. Any ideas? Is it know issue on Windows?


Gradle Version: 2.14
Operating System: Windows 10

Hi Vital,

thanks for reporting! I opened GRADLE-3547 to track this issue. I hope to be able to look into it shortly.


Thank you, Stefan!