1

I am getting the below error when I try to execute the 'clean package' maven command. Any ideas why the stream is closed ?

However, when I launch the task by itself, it works:

gradlew 41_RunUIUnittests

My task:

task 41_RunUIUnittests {

   doLast {

      def buildDir = file('../../build/build.functionaltests')

 println '\tFrom ' + buildDir   

      mavenexec {

         workingDir  buildDir
         goals       'clean', 'package'
      }
   }
}

The error:

> Task :41_RunUIUnittests
---------------------------------------------------------------------------------------
        From C:\Users\toto\git\build\build.functionaltests
Could not read standard output of command 'cmd'.
java.io.IOException: write(91) failed: stream is closed
        at org.apache.commons.io.output.ClosedOutputStream.write(ClosedOutputStream.java:47)
        at java.base/java.io.OutputStream.write(OutputStream.java:157)
        at org.apache.commons.io.output.ProxyOutputStream.write(ProxyOutputStream.java:89)
        at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:67)
        at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53)
        at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
        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:834)

Note, I am using this plugin: gradle-maven-exec-plugin

Frederic
  • 2,015
  • 4
  • 20
  • 37
  • 1
    you describe how to avoid the error, but you do not describe, how to re-produce it? How do you execute the task, when you get the error? What other tasks are executed before? How does your build script look like? What Gradle version do you use, ... with the provided information, you will not get any answer. Please be more precise in your question. – rmunge May 22 '22 at 22:25

0 Answers0