113
Apache Ant Fail Task
This task is used to stop current build and throw BuildException. It exits from the current build and displays an exception message to the console.
The message attribute is used to set exception message to this element.
Apache Ant Fail Task Attributes
Attribute | Description | Required |
---|---|---|
message | A message to show the reason of fail. | No |
if | Only fail if a property exists in current directory. | No |
unless | Only fail if a property doesn’t exist in the current project | No |
Lets see some examples of Ant Fail Task which are given below.
Apache Ant Fail Task Example
Without message
Set message too
Using unless
Output:
fail: BUILD FAILED unless=it is unless message
Next TopicApache Ant Filter Task