Password input using Eclipse, Ant and AntForms

Some Ant tasks such as ftp and scp require the name and password of a user. Certainly you don’t want to have passwords in plaintext form in your build scripts. Ant’s input task can be used to read input such as passwords from the console, which is more safe. Unfortunately it also echoes the entered values back to the console in plaintext form, which might not be wanted. To prevent this, one could use a SecureInputHandler as desribed in a stackoverflow discussion. However, this does not work when envoked from within Eclipse, since it will just hang and keep on listening to your input no matter how often you press Enter. As far as I know, there is no direct solution to this, but there do exist some alternatives. I decided to use AntForms instead of input, since it’s comfortable to use and easy to setup. “AntForm is a java tool designed to add interaction to Ant scripts through graphical forms.” I will show you how to make a simple dialogue that asks the user to enter his user name and password. The input values will be stored in Ant properties, so that they can be used in further tasks such as ftp and scp. Just follow these steps:

I hope this was helpful to you. Don’t forget to remove the password echo.