ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Amerige <>
Subject Re: Syntax for Names: target, property, macrodef, etc.
Date Thu, 30 Jun 2011 13:51:28 GMT
Hi Dominique,

Thanks for the info.  And, also thanks for the specific example of the leading "-" character.

Because Ant has only a global namespace for property names (and other names like macrodef,
etc.), and for the case that a particular 
ant script inherits properties from the caller, I'm adopting a convention that will help us
know whether a particular name is local 
to the being-called ant script.  In particular, I'm favoring the convention that "local" names
begin with a dot.  We guarantee that 
the caller never has defined any names that begin with a dot, so there is never a problem
with conflicts.  I had considered both the 
"-" and the "." as a leading character to indicate the name is local.  But, you've given a
good reason to avoid "-".  Thanks!

Steve Amerige
SAS Institute, Deployment Software Developer

On 6/30/2011 9: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 as in:
>> <property name="xxx" .../>
>> <macrodef name="xxx" ...>
>> <target name="xxx" ...>
>> and so forth.  I can't find within the Ant manual any BNF that defines what
>> a valid name is allowed to be.
> Anything goes really, AFAIK. There is no specifications.
> Some names will create issues, for example<target name="-foo">  can't
> be called from the command line because -foo will be interpreted as a
> CLI switch and since not found Ant will error out. This "behavior" is
> relied upon to have "private" targets.
> Also remember this is XML land, so attribute whitespace normalization
> will apply (depending on the parser used possibly) which may result in
> some whitespaces being removed.
> But aside from these quirks, Ant does not put any restrictions on
> names in general. --DD
> PS: Also keep in mind that property expansion does occurs inside these
> names, but I assume you mean the names after expansion.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message