ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilbert Rebhan <>
Subject Re: Set value if directory exists
Date Fri, 11 Sep 2009 16:14:32 GMT
Mikael Petterson schrieb:
> Hi,
> How can I set the value of out.dir to /local/tmp/ if it exists.
> Currently  the second option when /tmp exists set the value out.dir  to
> /tmp/myuser
> I know that /local/tmp exists.
> //mike	
> 	<available property="out.dir" value="/local/tmp" type="dir"
> file="/local/tmp" />
> 	<available property="out.dir" value="/tmp/${}"
> type="dir" file="/tmp" />
> 	<property name="out.dir" location="." />

hi, problem is that the <available> task overwrites your property
out.dir, means it's set to /local/tmp first and then overwritten with

example =

<available property="out.dir" value="/local/test" type="dir"
file="/local/test" />

<echo>nr.1 $${out.dir} == ${out.dir}</echo>

<available property="out.dir" value="/home/${}" type="dir"
    file="/home/${}" />

<echo>nr.2 $${out.dir} == ${out.dir}</echo>

output =

 [echo] nr.1 ${out.dir} == /local/test
[available] DEPRECATED - <available> used to override an existing property.
[available]   Build file should not reuse the same property name for
different values.
     [echo] nr.2 ${out.dir} == /home/gilreb

didn't know that available task behaves against standard ant
conventions (property immutability)
last setting of the property wins, try to use different
propertynames for your available tasks.

didn't you get a similar output "deprecated ...", which ant version
did you use ?

Regards, Gilbert

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

View raw message