How to hide username and password in scm command via ant script
One answer
In the machine where you are running the ant script, run 'scm login' command in the terminal. This will create a configuration directory in the users <home directory>/.jazz-scm. If you look under the .jazz-scm directory, you will find a file called repositories.txt that has the encrypted password.
Any command (or script) that runs against the repository that was cached (after login) will use that credentials to contact the repository.
If you want change the configuration directory, you can provide the --config option to the scm tool. For ex: scm --config <some location> login ...
From then on all the commands should use scm --config <location> <command> .... to use the credentials cached in that location or set the env var SCM_CONFIG_DIRECTORY to that location and run the commands as usual without the --config option.
Note: The password caching provides a convenient way to run commands without specifying the username and password on every invocation of the command. Although the password is encrypted it should be cached in a secure location.
Comments
Balamurugan Selvarasu
Feb 19 '15, 4:34 a.m.In an ant script you can pass through the password while executing the script.
You can use input tag for reading the input and parsing through the script where ever password variable declared in the script.