Reputation: 307
Getting exception while gradle/gradlew build. Build without test cases is successful. This happening when I updated the gradle to 6.0.1
Works fine for gradle 5.6/6.2 version.
Could not write standard input to Gradle Test Executor 2.
java.io.IOException: The pipe is being closed
at java.base/java.io.FileOutputStream.writeBytes(Native Method)
at java.base/java.io.FileOutputStream.write(FileOutputStream.java:348)
at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:68)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:835)
Error: Could not find or load main class worker.org.gradle.process.internal.worker.GradleWorkerMain
Caused by: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain
FAILURE: Build failed with an exception.
Upvotes: 21
Views: 16057
Reputation: 1
In my case, I tried several methods, including stopping Gradle, clearing the cache, and deleting the Gradle folder, but none of them worked. Finally, I resolved the issue by changing the 'Build and Run Using' and 'Run Tests Using' settings in Settings > Build, Execution, Deployment > Build Tools > Gradle from Gradle to IntelliJ IDEA
Upvotes: 0
Reputation: 1
Have the same problem and can't figure it out. Cleaning cache does not help, neither deleting ./gradle
folder. Also tried change the version in wrapper properties - it doesn't help either.
What helped me was manually set Java version in Project Structure
menu and also change Gradle Distribution
from Wrapper
to Local installation
in menu Settings -> Build, Execution, Deployment ->Build Tools -> Gradle
. I am pretty sure that the root cause is in our project files (wrapper properties for example), but didn't get anywhere deeper.
Upvotes: 0
Reputation: 1
If its a windows system, then try deleting the .gradle folder from the user directory and try to build the gradle. This should solve the issue
Upvotes: 0
Reputation: 15338
I encountered this error and the one method I found was dump the whole $HOME/.gradle
cache and then rebuild the project.
Starting/Stopping IntellijIDEA and/or rebuilding did not help.
You know you have jumped the complexity shark somewhere when running lowly test cases starts to fail for obscure reasons.
Granted, this happened after a machine crash. But still..
Upvotes: 2
Reputation: 2480
I just had this happen, and found that stopping the gradle daemon resolved it for me:
gradle --stop
or
./gradlew --stop
depending on your setup (the daemon is relaunched when you attempt to build again).
Upvotes: 66