ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rainer Noack" <>
Subject RE: Creating new JARs based on property change
Date Wed, 16 Mar 2005 21:55:43 GMT

I'm not really sure what you mean.
Either you have one "boolean" property that tells you cfg has changed or not
Or you have two properties with last and current cfg.

In both cases you can use a combination of <condition> task and target's
<if> attribute:

Example for the second (more complex) case:

<target name="loadprop">
  <property name="cfg" location="..."/>
  <property file="" prefix="old"/>
  <condition property="cfg.changed">
    <not><equals arg1="${cfg}" arg2="${old.cfg}"/></not>

<target name="removejar" depends="loadprop" if="cfg.changed">
  <delete file="my.jar"/>
  <echo file="">${cfg}

<import file="${cfg}"/>

Make sure to have "removejar" in your depends chain.

Instead of the additional target you can also use ant-contrib's <if> task.



> -----Original Message-----
> From: Holger Rauch [] 
> Sent: Wednesday, March 16, 2005 5:52 PM
> To: Ant Users List;
> Subject: Re: Creating new JARs based on property change
> On Wed, 16 Mar 2005, Rainer Noack wrote:
> > Remove the existing jar.
> Sure, but I only want to remove the existing JAR if the 
> property indicating whether the JAR is supposed to be signed 
> has changed since otherwise I end up rebuilding the JAR file 
> even though it wasn't necessary. This property is set in a 
> build file that's loaded via <property name="cfg" 
> location="..."> and then <import file="${cfg}" />. What's the 
> proper way to determine a property change in such a case?
> TIA.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message