1

I have created a large script to be passed to an sshexec commandResource in ant as follows.

<sshexec host="${host.server}"
username="${username}"
password="${oracle.password}"
commandResource="path-to-file/script.txt"
/>

This is working as intended. There are several lines that will get executed on the server in that script. The contents of the script.txt file is as follows :

/script/compile_objects.sh /path-to-code/ login password
/script/compile_code.sh /path-to-code/ login password

However, I would prefer to not store the login and password as clear text in the script.txt file. Is it possible to pass parameters to each line of the command resource. I'm aware that each line in the command resource file gets executed in its own shell.

I tried string replacement from a property in the Ant script, but it failed with a bad substitution error like so. Is there another way to do this?

<property name="oracle.password" value="thepassword"/>

and then in the script file, alter to:

/script/compile_objects.sh /path-to-code/ login ${oracle.password}
/script/compile_code.sh /path-to-code/ login ${oracle.password}

This type of replacement works when using the command feature, but seems to fail when using commandResource.

Edit : I am using Apache Ant 1.9.4 and jsch-0.1.54.jar

  • Eliminate risk of exposing a password, by not using a password. Have you considered SSH key authentication? See: http://stackoverflow.com/questions/15906447/apache-ant-hide-secure-exec-task-arguments/15909721#15909721 – Mark O'Connor Mar 24 '17 at 00:11
  • The login/password is entered via an Oracle Form at runtime, before it is passed to an ANT script. This login/password varies based on which environment for which we will be building our code. SSH key auth is not an option for us. Thanks though. – Mestopholis Mar 24 '17 at 18:39

0 Answers0