ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <>
Subject Re: Syntax for Names: target, property, macrodef, etc.
Date Thu, 30 Jun 2011 17:10:15 GMT
On Thu, Jun 30, 2011 at 11:50 AM, Steve Amerige <> wrote:
> Hi Dominique and all,
> After considering that scriptdef, macrodef, and perhaps some other tags do
> not allow neither the "-" nor the "." as an initial character, I'm going to
> use the "_" character name prefix to indicate that a name is "local" to the
> current JVM.  For example:
> <var name="_i" value="1"/>
> Again, the point of this convention is to workaround the fact that my
> understanding is that there is no scoping for *property*, *var*, and other
> names in Ant.  So, is my understanding incorrect?
> Can one use namespaces to have real local variables, properties, etc.?  Is
> there any notion of scoping?  I'd love to hear what Ant is capable of doing
> with respect to var, property, macrodef, scriptdef, etc. scoping for Ant
> 1.6, 1.7, and 1.8.

Certainly there isn't much in the way of scoping for earlier versions
of Ant, though you can do things with varying degrees of success using
libraries along the lines of ant-contrib (there are most likely others
to assist in this).  As of Ant 1.8, the <local> task was provided to
declare a "level of locality" for a named property, i.e. "any changes
made to property P at or below the current scope are considered local
to this block."  The manual page for this task describes its use in
what I consider adequate (at least) detail.  As it took some doing (by
Peter O'Reilly as well as myself, if I recall correctly) to get this
functioning properly, I would heartily recommend its use.


> Thanks for your help.... it's very much appreciated!
> Best regards,
> Steve Amerige
> SAS Institute, Deployment Software Developer
> On 6/30/2011 11:54 AM, Dominique Devienne wrote:
>> On Thu, Jun 30, 2011 at 8:31 AM, Dominique Devienne<>
>>  wrote:
>>> On Thu, Jun 30, 2011 at 6:51 AM, Steve Amerige<>
>>>  wrote:
>>>> I'm looking for the authoritative specification within Ant for the value
>>>> of the name attribute
>>> PS: Also keep in mind that property expansion does occurs inside these
>>> names, but I assume you mean the names after expansion.
>> Hmmm, I believe that's wrong on second thought.
>> Target names are not expanded I now recall, and it's probably the same
>> for property and macro names.
>> Someone might want to give a more definitive answer on that. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message