2001-02-13 12:32:01 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2002-02-03 22:00:42 +00:00
|
|
|
<title>Fail Task</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h2><a name="fail">Fail</a></h2>
|
|
|
|
<h3>Description</h3>
|
|
|
|
<p>Exits the current build (just throwing a BuildException), optionally printing additional information.</p>
|
2001-03-29 10:21:12 +00:00
|
|
|
<p>The message of the Exception can be set via the message attribute
|
|
|
|
or character data nested into the element.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Parameters</h3>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">message</td>
|
|
|
|
<td valign="top">A message giving further information on why the build exited</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
2001-12-12 08:48:42 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">if</td>
|
|
|
|
<td valign="top">Only fail if a property of the given name exists
|
|
|
|
in the current project</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">unless</td>
|
|
|
|
<td valign="top">Only fail if a property of the given name doesn't
|
|
|
|
exist in the current project</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
</table>
|
2004-04-28 18:08:47 +00:00
|
|
|
|
|
|
|
<h3>Parameters specified as nested elements</h3>
|
|
|
|
|
|
|
|
<p>As an alternative to the <i>if</i>/<i>unless</i> attributes,
|
|
|
|
conditional failure can be achieved using a single nested condition.
|
|
|
|
For a complete list of core conditions, as well as information
|
|
|
|
about custom conditions, see <a href="conditions.html">here</a>.<br />
|
|
|
|
<b>Since Ant 1.6.2</b>
|
|
|
|
</p>
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Examples</h3>
|
|
|
|
<pre> <fail/></pre>
|
|
|
|
<p>will exit the current build with no further information given.</p>
|
|
|
|
<pre>
|
|
|
|
BUILD FAILED
|
|
|
|
|
|
|
|
build.xml:4: No message
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<pre> <fail message="Something wrong here."/></pre>
|
2004-04-28 18:08:47 +00:00
|
|
|
<p>will exit the current build and print something
|
|
|
|
like the following to wherever your output goes:
|
|
|
|
</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<pre>
|
|
|
|
BUILD FAILED
|
|
|
|
|
|
|
|
build.xml:4: Something wrong here.
|
|
|
|
</pre>
|
|
|
|
|
2001-03-29 10:21:12 +00:00
|
|
|
<pre> <fail>Something wrong here.</fail></pre>
|
|
|
|
<p>will give the same result as above.</p>
|
|
|
|
|
2004-04-28 18:08:47 +00:00
|
|
|
<pre> <fail unless="thisdoesnotexist"/></pre>
|
|
|
|
<p>will exit the current build and print something
|
|
|
|
like the following to wherever your output goes:
|
|
|
|
</p>
|
|
|
|
<pre>
|
|
|
|
BUILD FAILED
|
|
|
|
|
|
|
|
build.xml:2: unless=thisdoesnotexist
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
A simple example using conditions to achieve the same effect:
|
|
|
|
<pre>
|
|
|
|
<fail>
|
|
|
|
<not>
|
|
|
|
<isset property="thisdoesnotexist"/>
|
|
|
|
</not>
|
|
|
|
</fail>
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>Output:</p>
|
|
|
|
<pre>
|
|
|
|
BUILD FAILED
|
|
|
|
|
|
|
|
build.xml:2: condition satisfied
|
|
|
|
</pre>
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<hr>
|
2004-02-09 21:50:10 +00:00
|
|
|
<p align="center">Copyright © 2000-2001,2004 The Apache Software Foundation. All rights
|
2001-02-13 12:32:01 +00:00
|
|
|
Reserved.</p>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|