ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ondřej Světlík <ond...@svetlik.info>
Subject Adding reference while parsing a file
Date Wed, 30 Nov 2005 14:41:19 GMT
Hello all,

why the hell is ant adding reference while parsing a file? I have a very
simple example:

file 1: build.xml

<project name="path" default="all">
<import file="makro.xml" />
<target name="all">
        <pokus cesta="/tmp" />
        <property name="path1" refid="path1" />
        <echo message="${path1}" />
</target>
</project>

file 2: makro.xml
<project name="makro">
<macrodef name="pokus">
        <attribute name="cesta" />
        <sequential>
                <property name="temp" refid="path1" />
                <path id="path1">
                        <pathelement path="${temp}" />
                        <pathelement path="@{cesta}" />
                </path>
        </sequential>
</macrodef>
</project>

Calling ant should fail, because I call macro pokus without existing
reference path1, but it doesn't fail:

ondra:~/tmp/ant/path> ant
Buildfile: build.xml

all:
Overriding previous definition of reference to path1
     [echo]
/home/osvetlik/tmp/ant/path/${temp}:/home/osvetlik/tmp/ant/path/@{cesta}:/tmp

BUILD SUCCESSFUL
Total time: 0 seconds

Running ant -d gives me an answer, but that's all wrong:

ondra:~/tmp/ant/path> ant -d | grep path1
Adding reference: path1
Adding reference: path1
Overriding previous definition of reference to path1
Adding reference: path1
Setting project property: path1 ->
/home/osvetlik/tmp/ant/path/${temp}:/home/osvetlik/tmp/ant/path/@{cesta}:/tmp

Ant adds the reference 3 times. It seems like the reference is added each
time the parser finds <path id="..." />.

Is this really what it should be? I'm using ant-1.6.5 installed from
binary package directly from apache site.

Best regards

Ondrej Svetlik

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message