You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

fail.html 3.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css"/>
  5. <title>Fail Task</title>
  6. </head>
  7. <body>
  8. <h2><a name="fail">Fail</a></h2>
  9. <h3>Description</h3>
  10. <p>Exits the current build (just throwing a BuildException), optionally printing additional information.</p>
  11. <p>The message of the Exception can be set via the message attribute
  12. or character data nested into the element.</p>
  13. <h3>Parameters</h3>
  14. <table border="1" cellpadding="2" cellspacing="0">
  15. <tr>
  16. <td valign="top"><b>Attribute</b></td>
  17. <td valign="top"><b>Description</b></td>
  18. <td align="center" valign="top"><b>Required</b></td>
  19. </tr>
  20. <tr>
  21. <td valign="top">message</td>
  22. <td valign="top">A message giving further information on why the build exited</td>
  23. <td align="center" valign="top">No</td>
  24. </tr>
  25. <tr>
  26. <td valign="top">if</td>
  27. <td valign="top">Only fail if a property of the given name exists
  28. in the current project</td>
  29. <td align="center" valign="top">No</td>
  30. </tr>
  31. <tr>
  32. <td valign="top">unless</td>
  33. <td valign="top">Only fail if a property of the given name doesn't
  34. exist in the current project</td>
  35. <td align="center" valign="top">No</td>
  36. </tr>
  37. <tr>
  38. <td valign="top">status</td>
  39. <td valign="top">Exit using the specified status code;
  40. assuming the generated Exception is not caught, the
  41. JVM will exit with this status. <em>Since Ant 1.7</em></td>
  42. <td align="center" valign="top">No</td>
  43. </tr>
  44. </table>
  45. <h3>Parameters specified as nested elements</h3>
  46. <p>As an alternative to the <i>if</i>/<i>unless</i> attributes,
  47. conditional failure can be achieved using a single nested
  48. <code>&lt;condition&gt;</code> element, which should contain exactly one
  49. core or custom condition. For information about conditions, see
  50. <a href="conditions.html">here</a>.<br /><b>Since Ant 1.6.2</b>
  51. </p>
  52. <h3>Examples</h3>
  53. <pre> &lt;fail/&gt;</pre>
  54. <p>will exit the current build with no further information given.</p>
  55. <pre>
  56. BUILD FAILED
  57. build.xml:4: No message
  58. </pre>
  59. <pre> &lt;fail message=&quot;Something wrong here.&quot;/&gt;</pre>
  60. <p>will exit the current build and print something
  61. like the following to wherever your output goes:
  62. </p>
  63. <pre>
  64. BUILD FAILED
  65. build.xml:4: Something wrong here.
  66. </pre>
  67. <pre> &lt;fail&gt;Something wrong here.&lt;/fail&gt;</pre>
  68. <p>will give the same result as above.</p>
  69. <pre> &lt;fail unless=&quot;thisdoesnotexist&quot;/&gt;</pre>
  70. <p>will exit the current build and print something
  71. like the following to wherever your output goes:
  72. </p>
  73. <pre>
  74. BUILD FAILED
  75. build.xml:2: unless=thisdoesnotexist
  76. </pre>
  77. Using a condition to achieve the same effect:
  78. <pre>
  79. &lt;fail&gt;
  80. &lt;condition&gt;
  81. &lt;not&gt;
  82. &lt;isset property=&quot;thisdoesnotexist&quot;/&gt;
  83. &lt;/not&gt;
  84. &lt;/condition&gt;
  85. &lt;/fail&gt;
  86. </pre>
  87. <p>Output:</p>
  88. <pre>
  89. BUILD FAILED
  90. build.xml:2: condition satisfied
  91. </pre>
  92. <hr>
  93. <p align="center">Copyright &copy; 2000-2001,2004-2005 The Apache Software Foundation. All rights
  94. Reserved.</p>
  95. </body>
  96. </html>