Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Strange property problem

Strange property problem

2007-05-31       - By Kevin Jackson
Reply:     1     2     3     4  

Hi all,

I have a weird error caused by a property being wrong 50% of the time
and correct 50% of the time.

here's the relevant code:

build.properties
james.version=server-binary-next-major
james.home=/var/james
james.home.direct=/var/james-${james.version}

<macrodef name="ssh-cmd">
      <attribute name="command"/>
      <attribute name="fail" default="true"/>
      <sequential>
        <sshexec host="${deploy.machine.address}" port="${deploy.machine.ssh.port}"
            username="root" password="${deploy.machine.root.user.password}"
            command="@{command}"
            failonerror="@{fail}" trust="true"/>
      </sequential>
    </macrodef>

<echo>james-${james.version}.tar.gz</echo>
<ssh-cmd command="cd /var;tar xzvpf
/root/james-${james.version}.tar.gz;chown -R james:james
${james.home.direct}"/>

Ok
the <echo> produces the following:

james-server-binary-next-major.tar.gz

in the ssh-cmd, the output of the tar xzvpf /root/james-${james.version}.tar.gz

tar xzvf /root/james-server-next-major.tar.gz

finally the chown -r james:james ${james.home.direct}
fails with /var/james/james-server-binary-next-major doesn't exist

so the echo thinks that ${james.version} = server-binary-next-major
the ssh-cmd macro thinks :
1 - ${james.version} = server-next-major
2 - then ${james.version} = server-binary-next-major

With ant properties are immutable, so what the hell is happening?

Kev

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.