ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amshoff <christoph.amsh...@fja.com>
Subject Order of property tasks relevant?
Date Thu, 07 Sep 2000 09:09:03 GMT
Hi.

I just started with Ant (Release 1.1, Win NT) and am wondering
about the way properties are resolved.

For example: given the following buildfile

<?xml version="1.0"?>
<project name="JJSys" default="main" basedir=".">
  <target name="main" depends="A">
    <echo message="var is '${var}'" />
  </target>
  <target name="A" depends="B">
    <echo message="var is '${var}'" />
  </target>
  <target name="B">
    <property name="var" value="some value"/>
    <echo message="var is '${var}'" />
  </target>
</project>

and building the default target 'main' I would expect the
property 'var' to be set in all targets 'main', 'A' and 'B'.
In fact, the output is

Buildfile: test.xml

B:
var is 'some value'

A:
var is '${var}'

main:
var is '${var}'

BUILD SUCCESSFUL

It seems to make a difference where the definition of the
property (and target 'B') is noted in the buildfile, because
if I swap the definition of targets 'B' and 'A' in the code,
'var' is resolved in 'A', too.
Thus, the properties are resolved only at locations in the
buildfile which are below their definition task? This is IMHO
not documented in the user manual.
Is it a feature? Or a bug?

Thanks for any help on this.
Christoph.


Mime
View raw message