<fail>

The <fail> task serves the purpose of exiting the current build while also allowing you to specify a message to be displayed upon exit.

Table 4.34 lists the attributes of this task.

Table 4.34. Table of <fail> Attributes
Attributes (Optional) Description
if If specified, the build will fail only if this property does exist.
message The message to be displayed when the build exits.
unless If specified, the build will fail only if this property does not exist.

Examples

The following example will result in the build exiting and reporting the line number that the build exited at. For example, E:\javadevelopment\build.xml:190: No message.

<fail/> 

The message can be set using either of the following two techniques:

 <fail message="classpath ...

Get Ant Developer’s Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.