Apache Ant : Input task - problem on reading multiple things from console - Stream is closed issue.

Share on:

Using Ant 1.8 (eventually they have changed the implementation from 1.7 and onwards) in case you use the Input task to read multiple things from the system console and load them into properties or do what ever you like - you will end up with a Stream is closed IOexception the second time you will invoke an Input Task.The code responsible is the class DefaultInputReader.

To save you some time (me and my colleague Manos - who had with the initial problem) please head to this Apache Ant Bugzilla issue end either:

  1. Subclass your own DefaultInputReader and feed it to with the appropriate property to the Input task - using the fix suggested(see comment by Kelly Davis) ( Use a KeepAliveInputStream)

or

  1. Just upgrade to Apache Ant 1.8.2.

Hope it helps!