ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <sflo...@nc.rr.com>
Subject Re: How to make exec not run by timestamp?
Date Tue, 30 Dec 2008 17:13:41 GMT

You can try the following:

Stock Ant:

1) Wrap your call to exec in a target, and place an "if" on the target:

<project>
   <condition  property = "file.found">
     <available  file = "your.file"/>
   </condition>

   <target name="exec"  if = "file.found">
     <exec...>
       ...
     </exec>

     <touch  file = "your.file"/>
   </target>
</project>

2) Use AntContrib's if task:

<project>
   <!-- include Ant Contrib here... -->

   <if>
     <available  file = "your.file"/>
     <then>
       <exec...>
         ...
       </exec>

       <touch  file = "your.file"/>
     </then>
   </if>
</project>




On Mon, 29 Dec 2008, removeps-generic@yahoo.com wrote:

> How can I make the exec task smart enough so that it won't do anything if the file generated
by the task has already been created?
>
> For example,
>
>   <copy file="srcFile.txt" tofile="destFile.txt" verbose="true"/>
>
> does nothing the second time.  Not sure how it works, but maybe if the timestamp of destFile.txt
is equal to or larger than srcFile.txt than nothing happens.
>
> So what I want is something like a generatedfile argument for exec.  For example:
>
>    <exec executable="${java.home}/bin/keytool.exe" generatedfile="${keystore}">
>      <arg value="-genkey"/>
>      <arg value="-alias"/>
>      <arg value="${alias}"/>
>      <arg value="-keyalg"/>
>      <arg value="RSA"/>
>      <arg value="-validity"/>
>      <arg value="36000"/>
>      <arg value="-keystore"/>
>      <arg value="${keystore}"/>
>      <arg value="-storepass"/>
>      <arg value="${storepass}"/>
>      <arg value="-keypass"/>
>      <arg value="${keypass}"/>
>      <arg value="-dname"/>
>      <arg value="${dname}"/>
>    </exec>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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

Architect Keros          http://sourceforge.net/projects/keros

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


Mime
View raw message