Reputation: 967
I have defined a macro in ant script which takes host as parameter:
<macrodef name="upload">
<attribute name="host"/>
<sequential>
<echo>Uploading source code to @{host}...</echo>
<scp trust="true"
file="package/code.zip"
todir="${webserver.username}@@{host}:${webserver.upload_dir}"
keyfile="${webserver.keyfile}"
passphrase="" />
</sequential>
</macrodef>
Problem is I can't figure out how to use @{host} in todir string as it already has a '@' character between username and host.
Upvotes: 3
Views: 443
Reputation:
Per : https://ant.apache.org/manual/Tasks/macrodef.html ,
The escape sequence @@ is used to escape @.
This allows @{x} to be placed in the text without substitution of x by using @@{x}.
So try with adding additional '@' prior to getting value of host attribute.
Also you could try setting <property name="token" value="@"/>
and use it withing todir with ${token} to see if that helps
Upvotes: 3