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 2.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. </table>
  37. <h3>Parameters specified as nested elements</h3>
  38. <p>As an alternative to the <i>if</i>/<i>unless</i> attributes,
  39. conditional failure can be achieved using a single nested
  40. &lt;condition&gt; element, which should contain exactly one
  41. core or custom condition. For information about conditions, see
  42. <a href="conditions.html">here</a>.<br /><b>Since Ant 1.6.2</b>
  43. </p>
  44. <h3>Examples</h3>
  45. <pre> &lt;fail/&gt;</pre>
  46. <p>will exit the current build with no further information given.</p>
  47. <pre>
  48. BUILD FAILED
  49. build.xml:4: No message
  50. </pre>
  51. <pre> &lt;fail message=&quot;Something wrong here.&quot;/&gt;</pre>
  52. <p>will exit the current build and print something
  53. like the following to wherever your output goes:
  54. </p>
  55. <pre>
  56. BUILD FAILED
  57. build.xml:4: Something wrong here.
  58. </pre>
  59. <pre> &lt;fail&gt;Something wrong here.&lt;/fail&gt;</pre>
  60. <p>will give the same result as above.</p>
  61. <pre> &lt;fail unless=&quot;thisdoesnotexist&quot;/&gt;</pre>
  62. <p>will exit the current build and print something
  63. like the following to wherever your output goes:
  64. </p>
  65. <pre>
  66. BUILD FAILED
  67. build.xml:2: unless=thisdoesnotexist
  68. </pre>
  69. Using a condition to achieve the same effect:
  70. <pre>
  71. &lt;fail&gt;
  72. &lt;condition&gt;
  73. &lt;not&gt;
  74. &lt;isset property=&quot;thisdoesnotexist&quot;/&gt;
  75. &lt;/not&gt;
  76. &lt;/condition&gt;
  77. &lt;/fail&gt;
  78. </pre>
  79. <p>Output:</p>
  80. <pre>
  81. BUILD FAILED
  82. build.xml:2: condition satisfied
  83. </pre>
  84. <hr>
  85. <p align="center">Copyright &copy; 2000-2001,2004 The Apache Software Foundation. All rights
  86. Reserved.</p>
  87. </body>
  88. </html>