ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Vogel <>
Subject RE: over-riding properties and the concept of scope
Date Fri, 06 Jul 2001 06:07:06 GMT
I general, this behavior (first definition overrides all others) is
the *correct* behavior for build infrastructures.  In the case where there
are low-level buildfiles that are normally called by individual developers,
while a "meta" buildfile is at the top level normally called by the 
build/release engineer.  The top-level buildfile may define things to 
ensure everything is done with a consistent set of tools, etc. and possibly
"publishes" the build to a standard location, while the lower-level
may have appropriate settings for developers.

There are times, however, when having the lower levels override the upper
is more appropriate, but they are far rarer than the more frequent case
discussed above.  Hopefully ant2 will have some *explicit* method for
a lower level to override the upper levels, one that can be grepped for
so that the build engineer can catch it if someone overrides something they
shouldn't in a lower level buildfile.

See Peter D, I don't *always* "drone on" about the same things :-)


> -----Original Message-----
> From: Stefan Bodewig []
> Sent: Thursday, July 05, 2001 10:57 PM
> To:
> Subject: Re: over-riding properties and the concept of scope
> On Thu, 5 Jul 2001, <> wrote:
> > I have set up a project with some sub-projects that could be
> > stand-alone, but can also be a called from a "meta" build-file that
> > builds all sub-projects.  If I have variables with the same name in
> > the main build-file they will over-ride the variable in the
> > sub-build-file.
> Yes, this has been identified as a problem of current Ant (one of
> many, to be honest).  Ant2 will provide more control over which
> properties are going to be passed to the subbuild - and maybe we'll
> even have a backwards compatible solution for this problem in the Ant1
> series.
> > I find this to be counter-intuitive because it's exactly the
> > opposite of the way variable scope normally works-- normally "inner"
> > declarations override "outer" declarations.
> Consider properties to be constants, just that it doesn't cause an
> error when you try to change them.
> The main reason for the current precedence rules (first definition
> wins) was that properties specified on the command line should
> override any later definition IIRC.
> Stefan

View raw message