ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Robert H - MWT" <Anderson.Rob...@menlolog.com>
Subject RE: Getting input in a custom ant task
Date Fri, 09 May 2003 15:57:16 GMT
Perhaps a combination of the <input>, <replace> and <zip> tasks would suit
your needs without having to use a custom task. This is how I would do it...

Create a reademe.txt file with a replacement token. During the build promt
for input with the input task. Then use the <replace> task the enter the
intup into the readme.txt file. Then zip it up.

I know this does not answer your question but it might help you get the
results you want.

-Rob A

-----Original Message-----
From: Baldry, Scot M [mailto:Scot.Baldry@gs.com]
Sent: Friday, May 09, 2003 6:13 AM
To: 'ant-user@apache.org'
Cc: Weir, John
Subject: Getting input in a custom ant task


Hi,

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?

Scot

Mime
View raw message