ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: <property file="..." prefix="..."/> what to expand?
Date Fri, 18 Jun 2010 07:47:44 GMT
On 2010-06-17, Jesse Glick wrote:

> On 06/17/2010 11:10 AM, Stefan Bodewig wrote:

>> Ant 1.8.1 uses the prefix when expanding ${x} inside the file and
>> thus expands ${foo.y} to "x" which makes sense in that it makes the
>> property file self-contained.

> When is this an advantage?

If you want to write a properties file that references properties
defined inside the same file and the use a prefix when loading the file,
you'd have to know the prefix when writing the properties file.

Assume

x=x
y=${x}

and that there is no property x defined prior to

    <property file="..."/>

then ${y} will be "x".  Using

    <property file="..." prefix="foo"/>

${foo.y} in Ant 1.8.0 is ${x} while it is "x" in 1.8.1 - the properties
file was able to refer to its own properties without knowledge of the
prefix.

>>    (3) allow different behavior of the tasks and document it.

> Probably recommend this. Don't know much about <loadproperties>

We advertize <loadproperties> as <property file> plus filterchains (and
the task fails if the file is not there).  You get
<property file="" prefix=""> behavior in <loadproperties> with a
prefixlines filter.  There is an additional prefix attribute on the task
that makes it prefix property resoltion as well.

> but breaking the established behavior of the widely used <property>
> task seems a bad idea.

I tend to agree, but we are really talking about some sort of
bordercase.

Stefan

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


Mime
View raw message