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

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