Search code examples
anterror-handlingnant

Ant equivalent of nant.onsuccess / nant.onfailure


NAnt has two built-in properties, nant.onsuccess and nant.onfailure, for specifying tasks to run on success and failure respectively.

Is there an equivalent in Ant?


Solution

  • I don't think there's an ant equivalent but you could use trycatch (part of ant-contrib)

    <trycatch>
      <try>
        <!-- Your code here -->
        <!-- Success message -->
      </try>
      <catch>
        <!-- Fail message -->
      </catch>
    </trycatch> 
    

    Hope this helps