1 | <html>
|
---|
2 |
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Language" content="en-us">
|
---|
5 | <title>Input Task</title>
|
---|
6 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
7 | </head>
|
---|
8 |
|
---|
9 | <body>
|
---|
10 |
|
---|
11 | <h2><a name="input">Input</a></h2>
|
---|
12 | <h3>Description</h3>
|
---|
13 |
|
---|
14 | <p>Allows user interaction during the build process by prompting for
|
---|
15 | input. To do so, it uses the configured
|
---|
16 | <a href="../inputhandler.html">InputHandler</a>.</p>
|
---|
17 |
|
---|
18 | <p>The prompt can be set via the message attribute or as character
|
---|
19 | data nested into the element.</p>
|
---|
20 |
|
---|
21 | <p>Optinonally a set of valid imput arguments can be defined via the
|
---|
22 | validargs attribute. Input task will no accept value that don't match
|
---|
23 | one of the predefined.</p>
|
---|
24 |
|
---|
25 | <p>Optionally a property can be created from the value entered by the
|
---|
26 | user. This property can then be used during the following build
|
---|
27 | run. Input behaves according to <a href="property.html">property
|
---|
28 | task</a> which means that existing properties cannot be overriden.
|
---|
29 | Since Ant 1.6, <code><input></code> will not prompt for input if
|
---|
30 | a property should be set by the task that has already been set in the
|
---|
31 | project (and the task wouldn't have any effect).</p>
|
---|
32 |
|
---|
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 | overriden.</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> <input/></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> <input>Press Return key to continue...</input></pre>
|
---|
78 | <p>Will display the message "Press Return key to
|
---|
79 | continue..." and pause the build run until return key is pressed
|
---|
80 | (again, the concrete behavior is implementation dependent).</p>
|
---|
81 | <pre> <input
|
---|
82 | message="Press Return key to continue..."
|
---|
83 | /></pre>
|
---|
84 | <p>Will display the message "Press Return key to
|
---|
85 | continue..." and pause the build run until return key is pressed
|
---|
86 | (see above).</p>
|
---|
87 | <pre>
|
---|
88 | <input
|
---|
89 | message="All data is going to be deleted from DB continue (y/n)?"
|
---|
90 | validargs="y,n"
|
---|
91 | addproperty="do.delete"
|
---|
92 | />
|
---|
93 | <condition property="do.abort">
|
---|
94 | <equals arg1="n" arg2="${do.delete}"/>
|
---|
95 | </condition>
|
---|
96 | <fail if="do.abort">Build aborted by user.</fail>
|
---|
97 | </pre>
|
---|
98 | <p>Will display the message "All data is going to be deleted from
|
---|
99 | DB continue (y/n)?" and require 'y' to continue build or 'n' to
|
---|
100 | exit build with following message "Build aborted by
|
---|
101 | user.".</p>
|
---|
102 | <pre> <input
|
---|
103 | message="Please enter db-username:"
|
---|
104 | addproperty="db.user"
|
---|
105 | /></pre>
|
---|
106 | <p>Will display the message "Please enter db-username:" and set the
|
---|
107 | property <code>db.user</code> to the value entered by the user.</p>
|
---|
108 |
|
---|
109 | <pre> <input
|
---|
110 | message="Please enter db-username:"
|
---|
111 | addproperty="db.user"
|
---|
112 | defaultvalue="Scott-Tiger"
|
---|
113 | /></pre>
|
---|
114 | <p>Same as above, but will set <code>db.user</code> to the value
|
---|
115 | <i>Scott- Tiger</i> if the user enters no value (simply types
|
---|
116 | <return>).</p>
|
---|
117 |
|
---|
118 | <hr>
|
---|
119 | <p align="center">Copyright © 2001-2004 The Apache Software Foundation. All rights
|
---|
120 | Reserved.</p>
|
---|
121 | </body>
|
---|
122 | </html>
|
---|