Asserts a condition and makes the build fail (using a special kind of BuildException) if it doesn't hold true.
Attribute | Description | Required |
message | Message for the exception if the condition doesn't hold true. Defaults to "Assertion failed". | No. |
You can use all supported conditions of Ant's core as well as any class that implements the Condition interface as a nested child element. This element is required - exactly one child - and specifies the condition to assert.
Make the build fail with the message "foo is bar" if the
property foo
has the value bar:
<assertTrue message="foo is bar"> <not> <equals arg1="${foo}" arg2="bar"/> </not> </assertTrue message="foo is bar">