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.0 KiB

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