ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: Optional <entry/> if and only if properties file exists?
Date Thu, 13 Nov 2008 11:09:58 GMT

-----Original Message-----
From: Patrick Waugh [mailto:ptwaugh@gmail.com]
Sent: Thursday, November 13, 2008 11:58 AM
To: Ant Users List
Subject: Re: Optional <entry/> if and only if properties file exists?

/*
In other words, I need to test if the property file exists... and then
include that "code" only in this case.
*/


with Jan's macro =

<target name="checkprops">
 <condition property="propfileexists">
   <available file="path/to/your/propsfile"/>
 </condition>
   ...
</target>


<target name="foobar" depends="checkprops" unless="propfileexists">
<my.rapc/>
<target>

<target name="foobaz" depends="checkprops" if="propfileexists">
<my.rapc>
    <entry file="entryGUI.properties" />
</my.rapc>
<target>


or check the condition with antcontrib if/else in one target

<target ....
  <if>
   <available file="path/to/your/propsfile"/>
  <then>
    <my.rapc>
     <entry file="entryGUI.properties" />
    </my.rapc>
  </then>
  <else>
    <my.rapc/>
  </else>
 </if>
</target


Regards, Gilbert





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


Mime
View raw message