Another solution is try to save properties into *.properties or *.xml file(s) -
and load that file(s) with <property
file="..."/> or <xmlproperty file="somefile.xml"/> tasks (this is ant core
tasks).
Main problem is to load right file(s).
That can be do in two ways :
0. the simplest solution is use <if/> task from ant-contrib package, like this :
<if>
<available file="${gen.dir}"/>
<then>
<xmlproperty file="somefile.present.xml"/>
</then>
<else>
<xmlproperty file="somefile.absent.xml"/>
</else>
</if>
1. second way (if you don’t like external stuff) may be look like this :
<target name="xxxx">
....
<available file="${gen.dir}" property="is.present.flag" value="true"/>
....
</target>
<target name="load.if.present" if="is.present.flag" depends="xxxx">
<xmlproperty file="somefile.present.xml"/>
</target>
<target name="load.if.absent" unless="is.present.flag" depends="xxxx">
<xmlproperty file="somefile.absent.xml"/>
</target>
<target name="next.step" depends="load.if.present,load.if.absent">
....
</target>
P.S. sorry for my poor english :)
----====[]====----
С уважением, Пустовалов Михаил [mailto:[EMAIL PROTECTED]
RDC Protei
-----Original Message-----
From: Scot P. Floess [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 23, 2006 3:14 PM
To: Ant Users List
Subject: Re: AW: How to set properties when property is set
The only problem is he stated setting multiple properties...not a single
one....
Of course, I just chuckled to myself as I had forgotten the else
attribute on condition...
[EMAIL PROTECTED] wrote:
> <condition property="propfile" value="present.properties"
> else="absent.properties">
> <available file="${gen.dir}"/>
> </condition>
> <property file="${propfile}"/>
>
>
> Jan
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: Mikael Petterson (KI/EAB) [mailto:[EMAIL PROTECTED]
>> Gesendet: Dienstag, 23. Mai 2006 12:23
>> An: Ant Users List
>> Betreff: How to set properties when property is set
>>
>> Hi,
>>
>> I have a property that checks if a certain directory exists.
>> If that property, gen.dir.present, is true then I need to set
>> a bunch of properties. If false I set them to other values. Is
>> there a Smooth way to do this.
>>
>> <property name="gen.dir"
>> value="/vobs/rbs/sw/rbssw_boam/boam_subsys/boam_swb/boammao_swu
>> /src/ifac
>> e/gen"/>
>> <available file="${gen.dir}" property="gen.dir.present"/>
>> <echo message="New refactored structure for iface present:
>> ${gen.dir.present}"/>
>>
>> Cheers,
>>
>> //mikael
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]