ant contrib - Ant @ variable not resolved -


here snippet of build.xml

<target name="compile">   <for param="rsync.destination.host" list="${file}" delimiter="${line.separator}">     <sequential>     <echo message="${rsync.ssh.user}@@{rsync.destination.host}:${rsync.destination.base.dir}/"/>     </sequential>   </for> </target> 

i received following output,

compile:      [echo] root@{rsync.destination.host}:/tmp/      [echo] root@{rsync.destination.host}:/tmp/  build successful total time: 0 seconds 

so here @{rsync.destination.host} variable not interpreted because of double @@ character. if put space in between them

    <echo message="${rsync.ssh.user}@ @{rsync.destination.host}:${rsync.destination.base.dir}/"/> 

then variable resolved expected.

compile:      [echo] root@ server1:/tmp/      [echo] root@ server2:/tmp/  build successful total time: 0 seconds 

since there space in username , server through exception if perform ssh here. idea how solve problem.

there no variables in (core) ant, properties , attributes. @{foo} syntax accessing value of macrodef attribute inside macrodef. antcontrib task uses ant macrodef task under hood has same syntax.
try :

... <echo message="${rsync.ssh.user}@@@{rsync.destination.host}:${rsync.destination.base.dir}/"/> ... 

means use 3x @ instead of 2x @
param @{rsync.destination.host} has masked second @, in fact need use @ 3 times.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -