Home » Apache Ant Fail Task

Apache Ant Fail Task

by Online Tutorials Library

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


fail:  BUILD FAILED  unless=it is unless message  

You may also like