更新后Gradle构建失败

时间:2020-02-25 03:13:16

标签: gradle intellij-idea build build.gradle gradlew

在构建gradle / gradlew时获取异常。没有测试用例的构建成功。当我将gradle更新为6.0.1时会发生这种情况

适用于gradle 5.6 / 6.2版本。

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.

2 个答案:

答案 0 :(得分:0)

我只是发生了这种情况,发现停止gradle守护进程可以为我解决它:

gradle --stop

./gradlew --stop

取决于您的设置(当您尝试再次构建时,守护程序会重新启动)。

答案 1 :(得分:0)

我遇到了这个错误,我找到的一种方法是转储整个 $HOME/.gradle 缓存,然后重建项目。

启动/停止 IntellijIDEA 和/或重建没有帮助。

当运行低级测试用例开始因不明原因而失败时,您知道您已经在某处跳过了复杂性鲨鱼。

当然,这是在机器崩溃后发生的。但是还是..