You can use ant-contrib[1] <trycatch> task

<trycatch>
    <try>
        <!--whatever you want to do here-->
    </try>
    <catch>
        <!--handling error-->
    </catch>
    <finally>
        <!--closing code-->
    </finally>
</trycatch>


Read the instructions about how to <taskdef> the tasks in the jar

HTH
Luis

[1] http://ant-contrib.sourceforge.net/

-----Original Message-----
From: Anderson, Rob (Global Trade) [mailto:[EMAIL PROTECTED]
Sent: Monday, March 22, 2004 1:06 PM
To: Ant Users List
Subject: RE: don't fail build on failed task


The ant-contrib project has a <trycatch> task. I have not used it, but you might check 
it out to see if it meets your needs.

http://ant-contrib.sourceforge.net/

Look under "Other tasks" for the trycatch task documentation.

-Rob Anderson


> -----Original Message-----
> From: Dean A. Hoover [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 22, 2004 10:50 AM
> To: Ant Users List
> Subject: don't fail build on failed task
> 
> 
> I am using ant to build and deploy
> a webapp to tomcat. I have a deploy
> task and an undeploy task. The deploy
> task fails if the app is already deployed.
> The undeploy task fails if the app is
> not already deployed. I find myself
> constantly typing: ant undeploy deploy
> which works fine if the build goes ok.
> If the build does not go ok I have to
> type: ant deploy
> since it already removed the app.
> I would like to make the undeploy
> task report failure to output but not
> really fail. That way, I can have the
> deploy task depend on the undeploy
> task and simplify things. If this is in
> the documentation, I cannot find it.
> 
> Here is my undeploy task:
> 
>     <target name="undeploy"
>             description="Undeploy web application" depends="init">
>         <undeploy url="${local.tomcat.url}"
>                             username="${local.tomcat.username}"
>                             password="${local.tomcat.password}"
>                             path="${local.tomcat.path}"/>
>     </target>
> 
> Any takers?
> Dean Hoover
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to