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.

input.html 4.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Input Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="input">Input</a></h2>
  8. <h3>Description</h3>
  9. <p>Allows user interaction during the build process by prompting for
  10. input. To do so, it uses the configured
  11. <a href="../inputhandler.html">InputHandler</a>.</p>
  12. <p>The prompt can be set via the message attribute or as character
  13. data nested into the element.</p>
  14. <p>Optionally a set of valid input arguments can be defined via the
  15. validargs attribute. Input task will not accept a value that doesn't match
  16. one of the predefined.</p>
  17. <p>Optionally a property can be created from the value entered by the
  18. user. This property can then be used during the following build
  19. run. Input behaves according to <a href="property.html">property
  20. task</a> which means that existing properties cannot be overriden.
  21. Since Ant 1.6, <code>&lt;input&gt;</code> will not prompt for input if
  22. a property should be set by the task that has already been set in the
  23. project (and the task wouldn't have any effect).</p>
  24. <h3>Parameters</h3>
  25. <table border="1" cellpadding="2" cellspacing="0">
  26. <tr>
  27. <td valign="top"><b>Attribute</b></td>
  28. <td valign="top"><b>Description</b></td>
  29. <td align="center" valign="top"><b>Required</b></td>
  30. </tr>
  31. <tr>
  32. <td valign="top">message</td>
  33. <td valign="top">the Message which gets displayed to the user
  34. during the build run.</td>
  35. <td valign="top" align="center">No</td>
  36. </tr>
  37. <tr>
  38. <td valign="top">validargs</td>
  39. <td valign="top">comma separated String containing valid input
  40. arguments. If set, input task will reject any input not defined
  41. here. Validargs are compared case sensitive. If you want 'a' and
  42. 'A' to be accepted you will need to define both arguments within
  43. validargs.</td>
  44. <td valign="top" align="center">No</td>
  45. </tr>
  46. <tr>
  47. <td valign="top">addproperty</td>
  48. <td valign="top">the name of a property to be created from
  49. input. Behaviour is equal to <a href="property.html">property
  50. task</a> which means that existing properties cannot be
  51. overridden.</td>
  52. <td valign="top" align="center">No</td>
  53. </tr>
  54. <tr>
  55. <td valign="top">defaultvalue</td>
  56. <td valign="top">Defines the default value of the property to be
  57. created from input. Property value will be set to default if no
  58. input is received.</td>
  59. <td valign="top" align="center">No</td>
  60. </tr>
  61. </table>
  62. <h3>Examples</h3>
  63. <pre> &lt;input/&gt;</pre>
  64. <p>Will pause the build run until return key is pressed when using the
  65. <a href="../inputhandler.html#defaulthandler">default
  66. InputHandler</a>, the concrete behavior is defined by the InputHandler
  67. implementation you use.</p>
  68. <pre> &lt;input&gt;Press Return key to continue...&lt;/input&gt;</pre>
  69. <p>Will display the message &quot;Press Return key to
  70. continue...&quot; and pause the build run until return key is pressed
  71. (again, the concrete behavior is implementation dependent).</p>
  72. <pre> &lt;input
  73. message=&quot;Press Return key to continue...&quot;
  74. /&gt;</pre>
  75. <p>Will display the message &quot;Press Return key to
  76. continue...&quot; and pause the build run until return key is pressed
  77. (see above).</p>
  78. <pre>
  79. &lt;input
  80. message=&quot;All data is going to be deleted from DB continue (y/n)?&quot;
  81. validargs=&quot;y,n&quot;
  82. addproperty=&quot;do.delete&quot;
  83. /&gt;
  84. &lt;condition property=&quot;do.abort&quot;&gt;
  85. &lt;equals arg1=&quot;n&quot; arg2=&quot;${do.delete}&quot;/&gt;
  86. &lt;/condition&gt;
  87. &lt;fail if=&quot;do.abort&quot;&gt;Build aborted by user.&lt;/fail&gt;
  88. </pre>
  89. <p>Will display the message &quot;All data is going to be deleted from
  90. DB continue (y/n)?&quot; and require 'y' to continue build or 'n' to
  91. exit build with following message &quot;Build aborted by
  92. user.&quot;.</p>
  93. <pre> &lt;input
  94. message=&quot;Please enter db-username:&quot;
  95. addproperty=&quot;db.user&quot;
  96. /&gt;</pre>
  97. <p>Will display the message &quot;Please enter db-username:&quot; and set the
  98. property <code>db.user</code> to the value entered by the user.</p>
  99. <pre> &lt;input
  100. message=&quot;Please enter db-username:&quot;
  101. addproperty=&quot;db.user&quot;
  102. defaultvalue=&quot;Scott-Tiger&quot;
  103. /&gt;</pre>
  104. <p>Same as above, but will set <code>db.user</code> to the value
  105. <i>Scott- Tiger</i> if the user enters no value (simply types
  106. &lt;return&gt;).</p>
  107. <hr>
  108. <p align="center">Copyright &copy; 2001-2004 The Apache Software Foundation. All rights
  109. Reserved.</p>
  110. </body>
  111. </html>