1 | <!--
|
---|
2 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | contributor license agreements. See the NOTICE file distributed with
|
---|
4 | this work for additional information regarding copyright ownership.
|
---|
5 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | (the "License"); you may not use this file except in compliance with
|
---|
7 | the License. You may obtain a copy of the License at
|
---|
8 |
|
---|
9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 |
|
---|
11 | Unless required by applicable law or agreed to in writing, software
|
---|
12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | See the License for the specific language governing permissions and
|
---|
15 | limitations under the License.
|
---|
16 | -->
|
---|
17 | <html>
|
---|
18 |
|
---|
19 | <head>
|
---|
20 | <meta http-equiv="Content-Language" content="en-us">
|
---|
21 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
22 | <title>Redirector Type</title>
|
---|
23 | </head>
|
---|
24 |
|
---|
25 | <body>
|
---|
26 |
|
---|
27 | <h2><a name="redirector">I/O redirection</a></h2>
|
---|
28 | <p>For many tasks, input and output can be defined in a fairly
|
---|
29 | straightforward fashion. The <a href="../CoreTasks/exec.html">exec</a>
|
---|
30 | task, used to execute an external process, stands as a very
|
---|
31 | basic example. The executed process may accept input, produce
|
---|
32 | output, or do either or both depending upon various circumstances.
|
---|
33 | Output may be classified as "output" or as "error
|
---|
34 | output." The <code><redirector></code> type provides a concrete means
|
---|
35 | of redirecting input and output featuring the use of
|
---|
36 | <a href="./mapper.html">File Mapper</a>s to specify
|
---|
37 | source (input) and destination (output/error) files. <em>Since Ant 1.6.2</em>
|
---|
38 | <p>The <code><redirector></code> element accepts the following attributes:</p>
|
---|
39 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
40 | <tr>
|
---|
41 | <td valign="top"><b>Attribute</b></td>
|
---|
42 | <td valign="top"><b>Description</b></td>
|
---|
43 | <td align="center" valign="top"><b>Required</b></td>
|
---|
44 | </tr>
|
---|
45 | <tr>
|
---|
46 | <td valign="top">output</td>
|
---|
47 | <td valign="top">Name of a file to which output should be written.
|
---|
48 | If the error stream is not also redirected to a file or property,
|
---|
49 | it will appear in this output.</td>
|
---|
50 | <td align="center" valign="top">No</td>
|
---|
51 | </tr>
|
---|
52 | <tr>
|
---|
53 | <td valign="top">error</td>
|
---|
54 | <td valign="top">The file to which the standard error of the
|
---|
55 | command should be redirected.</td>
|
---|
56 | <td align="center" valign="top">No</td>
|
---|
57 | </tr>
|
---|
58 | <tr>
|
---|
59 | <td valign="top">logError</td>
|
---|
60 | <td valign="top">This attribute is used when you wish to see
|
---|
61 | error output in Ant's log and you are redirecting output to
|
---|
62 | a file/property. The error output will not be included in
|
---|
63 | the output file/property. If you redirect error with the
|
---|
64 | <i>error</i> or <i>errorProperty</i> attributes, this will
|
---|
65 | have no effect.</td>
|
---|
66 | <td align="center" valign="top">No</td>
|
---|
67 | </tr>
|
---|
68 | <tr>
|
---|
69 | <td valign="top">append</td>
|
---|
70 | <td valign="top">Whether output and error files should be
|
---|
71 | appended to rather than overwritten. Defaults to
|
---|
72 | <code>false</code>.</td>
|
---|
73 | <td align="center" valign="top">No</td>
|
---|
74 | </tr>
|
---|
75 | <tr>
|
---|
76 | <td valign="top">createemptyfiles</td>
|
---|
77 | <td valign="top">Whether output and error files should be
|
---|
78 | created even when empty. Defaults to <code>true</code>.</td>
|
---|
79 | <td align="center" valign="top">No</td>
|
---|
80 | </tr>
|
---|
81 | <tr>
|
---|
82 | <td valign="top">outputproperty</td>
|
---|
83 | <td valign="top">The name of a property in which the output of the
|
---|
84 | command should be stored. Unless the error stream is redirected
|
---|
85 | to a separate file or stream, this property will include the
|
---|
86 | error output.</td>
|
---|
87 | <td align="center" valign="top">No</td>
|
---|
88 | </tr>
|
---|
89 | <tr>
|
---|
90 | <td valign="top">errorproperty</td>
|
---|
91 | <td valign="top">The name of a property in which the standard error
|
---|
92 | of the command should be stored.</td>
|
---|
93 | <td align="center" valign="top">No</td>
|
---|
94 | </tr>
|
---|
95 | <tr>
|
---|
96 | <td valign="top">input</td>
|
---|
97 | <td valign="top">A file from which the executed command's standard input
|
---|
98 | is taken. This attribute is mutually exclusive with the
|
---|
99 | <i>inputstring</i> attribute.</td>
|
---|
100 | <td align="center" valign="top">No</td>
|
---|
101 | </tr>
|
---|
102 | <tr>
|
---|
103 | <td valign="top">inputstring</td>
|
---|
104 | <td valign="top">A string which serves as the input stream for the
|
---|
105 | executed command. This attribute is mutually exclusive with the
|
---|
106 | <i>input</i> attribute.</td>
|
---|
107 | <td align="center" valign="top">No</td>
|
---|
108 | </tr>
|
---|
109 | <tr>
|
---|
110 | <td valign="top">inputencoding</td>
|
---|
111 | <td valign="top">The input encoding.</td>
|
---|
112 | <td align="center" valign="top">No</td>
|
---|
113 | </tr>
|
---|
114 | <tr>
|
---|
115 | <td valign="top">outputencoding</td>
|
---|
116 | <td valign="top">The output encoding.</td>
|
---|
117 | <td align="center" valign="top">No</td>
|
---|
118 | </tr>
|
---|
119 | <tr>
|
---|
120 | <td valign="top">errorencoding</td>
|
---|
121 | <td valign="top">The error encoding.</td>
|
---|
122 | <td align="center" valign="top">No</td>
|
---|
123 | </tr>
|
---|
124 | <tr>
|
---|
125 | <td valign="top">alwayslog</td>
|
---|
126 | <td valign="top">Always send to the log in addition to
|
---|
127 | any other destination. <i>Since Ant 1.6.3</i>.
|
---|
128 | </td>
|
---|
129 | <td align="center" valign="top">No, default is <code>false</code></td>
|
---|
130 | </tr>
|
---|
131 | <tr>
|
---|
132 | <td valign="top">loginputstring</td>
|
---|
133 | <td valign="top">Controls the display of <i>inputstring</i>'s value in
|
---|
134 | log messages. Set to <code>false</code> when sending sensitive data
|
---|
135 | (e.g. passwords) to external processes. <i>Since Ant 1.6.3</i>.
|
---|
136 | </td>
|
---|
137 | <td align="center" valign="top">No, default is <code>true</code></td>
|
---|
138 | </tr>
|
---|
139 | </table>
|
---|
140 | <h3>Parameters specified as nested elements</h3>
|
---|
141 | <h4>inputmapper</h4>
|
---|
142 | <p>A single <a href="./mapper.html">File Mapper</a> used to redirect process
|
---|
143 | input. Multiple mapping results should concatenate all mapped files as input.
|
---|
144 | Mapping will ordinarily be performed on a task-specified sourcefile;
|
---|
145 | consult the documentation of the individual task for more details.
|
---|
146 | A nested <code><inputmapper></code> is not compatible with either of the
|
---|
147 | <i>input</i> or <i>inputstring</i> attributes.</p>
|
---|
148 | <h4>outputmapper</h4>
|
---|
149 | <p>A single <a href="./mapper.html">File Mapper</a> used to redirect process
|
---|
150 | output. Mapping will ordinarily be performed on a task-specified sourcefile;
|
---|
151 | consult the documentation of the individual task for more details.
|
---|
152 | A nested <code><outputmapper></code> is not compatible with the
|
---|
153 | <i>output</i> attribute.</p>
|
---|
154 | <h4>errormapper</h4>
|
---|
155 | <p>A single <a href="./mapper.html">File Mapper</a> used to redirect error
|
---|
156 | output. Mapping will ordinarily be performed on a task-specified sourcefile;
|
---|
157 | consult the documentation of the individual task for more details.
|
---|
158 | A nested <code><errormapper></code> is not compatible with the
|
---|
159 | <i>error</i> attribute.</p>
|
---|
160 | <h4>inputfilterchain</h4>
|
---|
161 | <p>A <a href="./filterchain.html">FilterChain</a> can be
|
---|
162 | applied to the process input.</p>
|
---|
163 | <h4>outputfilterchain</h4>
|
---|
164 | <p>A <a href="./filterchain.html">FilterChain</a> can be
|
---|
165 | applied to the process output.</p>
|
---|
166 | <h4>errorfilterchain</h4>
|
---|
167 | <p>A <a href="./filterchain.html">FilterChain</a> can be
|
---|
168 | applied to the error output.</p>
|
---|
169 | <h3>Usage</h3>
|
---|
170 | Tasks known to support I/O redirection:
|
---|
171 | <ul>
|
---|
172 | <li><a href="../CoreTasks/exec.html">Exec</a></li>
|
---|
173 | <li><a href="../CoreTasks/apply.html">Apply</a></li>
|
---|
174 | <li><a href="../CoreTasks/java.html">Java</a></li>
|
---|
175 | </ul>
|
---|
176 | <p>The expected behavior of a <code><redirector></code> is to a great degree
|
---|
177 | dependent on the supporting task. Any possible points of confusion
|
---|
178 | should be noted at the task level.</p>
|
---|
179 |
|
---|
180 |
|
---|
181 | </body>
|
---|
182 | </html>
|
---|
183 |
|
---|