Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute a default task in ANT in case of failure

Tags:

java

exit

ant

I'm currently using ANT for building my Java project on a Windows XP machine. In my build.xml file I've defined 3 task and I would like that,in case of fail,a default task be executed before closing the building and exiting (like a recovery procedure). I would like to know if it's possible.

thanks

like image 699
Claus Avatar asked Jun 09 '10 08:06

Claus


People also ask

What is the default target in Ant?

As Ant runs, it displays the name of each target executed. As our example output shows, Ant executes prepare followed by compile . This is because compile is the default target, which has a dependency on the prepare target.

How do you run an Ant task?

To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.

What is Taskdef in Ant?

Class TaskdefAdds a task definition to the current project, such that this new task can be used in the current project. Two attributes are needed, the name that identifies this task uniquely, and the full name of the class (including the packages) that implements this task.

What is PathElement in Ant?

Path: This object represents a path as used by CLASSPATH or PATH environment variable. A path might also be described as a collection of unique filesystem resources. and PathElement: Helper class, holds the nested <pathelement> values.


1 Answers

Googled and found this. It's basically a try/catch for Ant. Might be worth a look: http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html

like image 157
Max Leske Avatar answered Oct 02 '22 22:10

Max Leske