ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "martin sweitzer" <>
Subject "post failure tasks" for failing targets
Date Mon, 12 Mar 2007 22:29:31 GMT
For a cruisecontrol set up we have a task called text2xml.  So for
text2xml to do its magic it needs to run :-)

This is problematic for something like:

<target name="foo" depends="">

    <exec dir="${binaries.dir}"
      <arg line="${commandLineParams}"/>

    <text2xml srcfile = "${compileOptions.logDir}/${exampleGame.log}.log"
       destfile = "${compileOptions.logDir}/${exampleGame.log}_log.xml"
       element = "${compileOptions.projectName}"
       attribute = "name"
       value = "${exampleGame.log}"


So the exec fires off and then it has an error so the failonerror
aborts the target and returns!

This is more generally formed as:  How do you do "post failure tasks"
for failing targets when the various exec type tasks return from a
failonerror="true" ?

Is there some way to register a "do after this fails" delegate that I
am missing?

>From another thread I saw the trycatch
(  Is
that the standard way of doing the above?

so if you have:

<target name="a" depends="b,c,d,e,f,g,h,i,j,k,l, taskToRunLast">

You would do something like:

<target name="aDoIt" depends="b,c,d,e,f,g,h,i,j,k,l">

<target name="a">

   <trycatch property="foo" reference="bar">
       <antcall target="aDoIt" />


       <antcall target="taskToRunLast" />


And then for each depends that also has some "post failure task" then
slap in a trycatch there also?

Seems to work pretty well in my quick test case.   Is this the way to go? :-)

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

View raw message