Chapter 10. Limit

## Limit

The Limit task is a task container (that is, it holds other tasks) and sets a time limit on how long the nested tasks are allowed to run. This is useful for unit tests that go awry, hung socket connections, or other potentially long running tasks that need to be shut off without stopping the build.

Table 10.1. Limit Task Attributes

Attribute | Description | Default | Required
--- | --- | --- | ---
maxwait | How long to wait for nested tasks to finish, this is in seconds. | 180 seconds (3 minutes) | No
failonerror | Should the build fail if the time limit has been exceeded? | false | No

Examples:

Neither the echo nor the fail will happen in this example. The build will continue once the time has expired.

    <limit maxwait="3">
       <sleep seconds="10"/>
       <echo>This won't happen...</echo>
       <fail>This won't happen either...</fail>
    </limit>

Neither the echo nore the fail will happen in this example. The build will not continue once the time has expired.

    <limit maxwait="3" failonerror="true">
       <sleep seconds="10"/>
       <echo>This won't happen...</echo>
       <fail>This won't happen either...</fail>
    </limit>

Copyright © 2003 Ant-Contrib Project. All rights Reserved.