[GRADLE-3547] Error opening jacocoagent.jar Created: 31/Aug/16  Updated: 30/Nov/16  Resolved: 30/Nov/16

Status: Resolved
Project: Gradle
Affects Version/s: 2.14
Fix Version/s: None

Type: Bug
Reporter: Stefan Wolf Assignee: Unassigned
Resolution: Duplicate Votes: 1


 Description   

See https://discuss.gradle.org/t/error-opening-jacocoagent-jar-due-to-long-path-to/19250

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:

:my.long.subproject.name:test
Error opening zip file or JAR manifest missing : ../../build/components/my.long.subproject.name/tmp/expandedArchives/org.jacoco.agent-0.7.6.201602180812.jar_29dabwwwl4sb8maj0h13tor2d/jacocoagent.jar
Error occurred during initialization of VM
agent library failed to init: instrument
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:56)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
        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)
:my.long.subproject.name:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':my.long.subproject.name:test'.
> 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 -Djava.security.manager=worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager -javaagent:../../build/components/my.long.subproject.name/tmp/expandedArchives/org.jacoco.agent-0.7.6.201602180812.jar_29dabwwwl4sb8maj0h13tor2d/jacocoagent.jar=destfile=../../build/components/my.long.subproject.name/jacoco/test.exec,append=true,inclnolocationclasses=false,dumponexit=true,output=file,jmx=false -Xms256m -Xmx1024m -Dfile.encoding=windows-1251 -Duser.country=US -Duser.language=en -Duser.variant -ea -cp C:\Users\Vital_Lobachevskij\.gradle\caches\2.14\workerMain\gradle-worker.jar worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 2'

It works in the same way for all subprojects. But, if the subproject name is rather long, e.g. ‘my.long.subproject.name’, Gradle can’t open jacocoagent.jar. On my local, full path to this jar for ‘my.long.subproject.name’ is
d:\Projects\...\build\components\my.long.subproject.name\tmp\expandedArchives\org.jacoco.agent-0.7.6.201602180812.jar_29dabwwwl4sb8maj0h13tor2d\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.



 Comments   
Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Brian Ray [ 29/Nov/16 ]

+1 for migrating this to GitHub issues. I'm running into it as well, down to the workaround of putting the build directory in a shorter path.

FWIW I'm running Gradle 3.1 and a Zulu OpenJDK 1.8.0_102-b14 build on Windows 7. It seems like the error is a limitation of Java itself.

Comment by Stefan Wolf [ 30/Nov/16 ]

Brian Ray: Could you open the issue on Github?

Comment by Benjamin Muschko [ 30/Nov/16 ]

Replaced by https://github.com/gradle/gradle/issues/949.

Comment by Brian Ray [ 30/Nov/16 ]

@wolf: Done as linked to in previous comment. If you need anything else let me know.

Thanks.

Generated at Wed Jun 30 12:51:39 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.