exec-maven-plugin icon indicating copy to clipboard operation
exec-maven-plugin copied to clipboard

Issue with async and outputFile

Open tarioch opened this issue 9 years ago • 5 comments

When I use both the async and outputFile option this does not seem to work. The output file is created but empty and the process hangs after a while trying to write to stdout.

I'm using 1.5.0 under Windows

tarioch avatar Aug 19 '16 06:08 tarioch

The problem here is simply the process you start will write something but it's buffered and only at the end of the run the outputFile content can be used... Furthermore to make analysis somehow possible an full working example project would be helpful...

khmarbaise avatar Aug 31 '16 19:08 khmarbaise

I have the following situation:

  • I'm starting (async) a server process which has lots of output on stdout.
  • At some point the buffer is full and the process blocks as it no longer can write to stdout

So if I understood you correctly, the implementation only uses a buffer and therefore will not work if more output than has space in the buffer is produced?

tarioch avatar Sep 01 '16 07:09 tarioch

Here is a simple example to illustrate the problem. At the end of mvn install, the target/stdout.log file is empty.

execstdoutbroken.zip

xandrewrampulla avatar Mar 09 '17 16:03 xandrewrampulla

I'm having the same issue

michaelpog avatar Jun 22 '17 23:06 michaelpog

Stumbled upon this in 2020 with Version 3.0.0, and did some research. As it is, this might be fixed fairly easy, by using the redirect-methods introduced into the ProcessBuilder with JDK 7 as of 2011. Unfortunately, the exec plugin relies on common-exec, which in turn hasn't been released since 2014, and has last been build maintaining backward compatibility to JDK 1.5.

So the options are: Swapping out commons-exec, or upgrading commons-exec first, in order to expose the methods of JDK 1.7.

By the way: to which degree do we maintain BC for this plugin? JDK 11?

gtsh avatar Jul 08 '20 23:07 gtsh