While ant is usually used to run scripts automatically there are times when one requires that a the user name and password be dynamically be fed. For this the ant core task Input is available. It is really a cool task which will allow for the prompting of required variables at runtime.
To syntax for this task is:
<input message=”Please enter db-username:” addproperty=”db.user” defaultvalue=”Scott-Tiger”/>
Using this will create a prompt when the script is run. But wait for password you don’t want the password to be seen by others do you? Well Input does not provide for that. You can extend Ant’s input capabilities by writing a subclass of org.apache.tools.ant.input.InputHandler where you replace each character with a * or you can use Jera Ant Tasks. The query Task should fulfill ones needs.