Chris,

I can think of one way, but it's not the cleanest.  Basically it
reverses the normal kind of looping logic:

<property name="success" value="false" />
<foreach item="String" property="count" in="1 2 3 4 5" delim=" ">
  <ifnot test="${success}">
    <trycatch>
      <try>
        <dostuff />
        <property name="success" value="true" />
      </try>
      <catch property="fail.message">
        <echo level="Warning" message="Failed on loop ${count}:
${fail.message}" />
        <sleep seconds="5" />
      </catch>
    </trycatch>
  </ifnot>
</foreach>
<fail message="Could not perform blah!" unless="${success}" />

Code might need tweaking, it's not tested, but the basic idea is that
the loop will be executed the same number of times regardless of if
the operation succeeds or not, but the actual operation will only be
attempted if it hasn't already succeeded.

You could make a cleaner loop using a custom task or function - look
at the source of the <foreach> task (in particular its superclass) for
guidance.


Regards,

-T


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to