How to apply a timeout to an Ant task?

Without writing a custom Ant task, is there a way to use the timeout for the Ant regular target?

To provide some background information: we use the "delete" task to delete the contents of this directory. Sometimes this directory is massive, with many generated folders and files. We wanted to get a timeout for this task, say, in 5 minutes.

+7
timeout ant
source share
2 answers

You can use the parallel task, which has a timeout with a parallel degree:

<target name="timed_del"> <parallel threadCount="1" timeout="300000"> <sequential> ... your tasks here ... </sequential> </parallel> </target> 
+10
source share

You can also use the limit task.

 <target name="my-target"> <limit seconds="2" failonerror="true"> <sshexec ... /> </limit> </target> 
0
source share

All Articles