File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant task failed due to confirmation prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant task failed due to confirmation prompt" Watch "Ant task failed due to confirmation prompt" New topic
Author

Ant task failed due to confirmation prompt

T. Anthony Chen
Ranch Hand

Joined: Jul 28, 2004
Posts: 38
I have an Exec task that runs a command which, depending on the situation at runtime, may prompt for user confirmation. Running the command alone, the user can choose to type Y or N, the default is N. Running from Ant, the task always fails if the prompt happens. I am guessing that is because a carriage return, which means N to the prompt, is always fed to it. But what I really want to give it is an Y.

Is there a way to feed a key stroke to the command when it is executed by Ant? Thanks.


T. Anthony Chen<br />---------------<br />SCJP, SCJD, SCBCD, SCWCD, SCEA
Dmitry Melnik
Ranch Hand

Joined: Dec 18, 2003
Posts: 328
In Windows most shell commands have an option to be executed in a "quiet" mode, without confirmation prompts. You can find out the specific syntax for such commands by entereing "help {your command}" in a console window.

There is also a way to redirect console input for a command to a text file with answers. Here is an example "xcopy foo.txt bar <yes.txt" Where the file yes.txt contains yes-answer(s)

I guess, similar techniques could be used with Unix shells, with a slightly different syntax.
T. Anthony Chen
Ranch Hand

Joined: Jul 28, 2004
Posts: 38
Dmitry, I went for your second approach and it worked! Many thanks!
 
 
subject: Ant task failed due to confirmation prompt
 
Similar Threads
How to stop the SimpleHTTPServer server ?
regarding batch file
How to suppress prompt?
Ant and command line args
Problem in running ant Build File in a Batch file