ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Macon Pegram" <>
Subject "Prompt" ANT task....
Date Mon, 06 May 2002 14:28:41 GMT
I have 2 questions, but first a little background:

I was recently looking at the FTP optional task in ANT and noticed that 
"User ID" and "Password" are required attributes.  This seems like a rather 
bad idea from a security standpoint, so I set out to do something about it.

My initial inclination was to extend the "FTP" task and create a "SecureFTP" 
task which would check to see if the values were input into the tags, and if 
not, prompt the user for these values.  After looking into this a bit 
further, I realized that this approach would not be practical because the 
userid and password variables are private, and no getter is available for 
these values.

That lead me to my current approach which is what I wanted to ask about.  
I've created a "Prompt" task which I actually like a lot better than any of 
the other approaches I considered.  The "Prompt" task will allow you to 
define: 1. A message to display when the user is prompted, 2. a Property 
name (which is a required attribute) to assign the user's input to, 3. a 
display type (more on that in a bit), and finally 4. Echo "on" or "off".

One would use the task to query the user for input, then assign that input 
value to a property which could be used later (say as a password property 
for FTP, or some other value you don't want to hard-code into the ANT 
script... The "display" property will allow the user to choose: text, gui, 
or automatic (which will try to do a gui, if that fails, it will revert to 
text).  The main rationale behind this is tied to the "echo" attribute.  If 
you want to prompt a user for a "password" then you probably want to turn 
"echo" "off" so that it doesn't appear on the screen.  Unfortunately, at the 
text-ui (or commandline) level in Java it is virtually impossible to prevent 
echo of text entered by the user... hence the AWT based GUI input method.

Now that I've provided all the background info, here are my two questions:
1. Is there any reason why ANT does not currently provide a task like this? 
Is there a good reason that "interactive" tasks are NOT provided?

2. Is there a standard that disallow's GUI's for ANT tasks (when a text 
interface is also provided)?

I'd like to contribute this task to Jakarta if you think's it's valuable, 
but I want to make sure it is within your guidelines.

Macon Pegram

Get your FREE download of MSN Explorer at

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message