ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Baldry, Scot M" <>
Subject Getting input in a custom ant task
Date Fri, 09 May 2003 13:12:47 GMT

I'm trying to write a custom ant task that will essentially jar up a
collection of classes and store an internal readme.txt that contains the
developers comments on why the changes have been packaged. To achieve this I
have extended the existing 'Zip' task and added my own routines to prompt
for comments and compose the readme.txt file.

The problem I am having is that the following lines of code cause very
strange behaviour when run as part of the task:

                System.out.print("\nWould you like to continue (Y/N): ");
                String response = input.readLine();
                if (response.equalsIgnoreCase("Y"))
                    return true;
                else if (response.equalsIgnoreCase("N"))
                    return false;
Basically, the build appears to hang but is infact waiting for input. When I
enter something and press return the output shows the line "Would you like
to continue?" - even though it appears before the input.readLine statement.
Since I do this in several places within the task I have made sure that the
various BufferedReaders that I use to grab input are being closed in the
relevant finally blocks.

I'm running Ant 1.5 on JDK 1.4.1 - as far as I can remember similar code ran
without problems under Ant 1.3 and Ant 1.4 under JDK 1.3. Anyone able to
provide an insight as to what may be happening?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message