Name
fail
Synopsis
Throws a BuildException, causing the current build
to fail.
Attributes
-
message(all, String, N) Specifies the message displayed when this task executes.
Content
- Text content. (1.4)
Ant 1.4 adds the ability to specify nested text. This is useful when the message spans multiple lines.
Example Usage
The following example aborts the build without any descriptive message:
<fail/>
In this case, Ant displays the following message, where 104 is the
line number in the buildfile of the line invoking
fail:
BUILD FAILED
C:\cvsdata\ant\mysamples\build.xml:104: No messageThe following call to fail results in a message
being displayed. The message is specified between the
<fail> and </fail>
tags.
<fail>Java version ${java.version} is not allowed!</fail>The next example produces the same results as the previous one; the
only difference is that the message is specified using the
message attribute.
<fail message="Java version ${java.version} is not allowed!"/>See Also
Use the echo task to write messages without aborting the build.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access