aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/ant/apache-ant-1.9.6/manual/Types/redirector.html
blob: d0e368388f45f6903cedf336fdc6e3237492f521 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
<title>Redirector Type</title>
</head>

<body>

<h2><a name="redirector">I/O redirection</a></h2>
<p>For many tasks, input and output can be defined in a fairly
straightforward fashion.  The <a href="../Tasks/exec.html">exec</a>
task, used to execute an external process, stands as a very
basic example.  The executed process may accept input, produce
output, or do either or both depending upon various circumstances.
Output may be classified as &quot;output&quot; or as &quot;error
output.&quot;  The <code>&lt;redirector&gt;</code> type provides a concrete means
of redirecting input and output featuring the use of
<a href="./mapper.html">File Mapper</a>s to specify
source (input) and destination (output/error) files.  <em>Since Apache Ant 1.6.2</em>
<p>The <code>&lt;redirector&gt;</code> element accepts the following attributes:</p>
<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">output</td>
    <td valign="top">Name of a file to which output should be written.
      If the error stream is not also redirected to a file or property,
      it will appear in this output.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">error</td>
    <td valign="top">The file to which the standard error of the
      command should be redirected.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">logError</td>
    <td valign="top">This attribute is used when you wish to see
      error output in Ant's log and you are redirecting output to
      a file/property. The error output will not be included in
      the output file/property. If you redirect error with the
      <i>error</i> or <i>errorProperty</i> attributes, this will
      have no effect.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">append</td>
    <td valign="top">Whether output and error files should be
      appended to rather than overwritten. Defaults to
      <code>false</code>.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">createemptyfiles</td>
    <td valign="top">Whether output and error files should be
      created even when empty.  Defaults to <code>true</code>.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">outputproperty</td>
    <td valign="top">The name of a property in which the output of the
      command should be stored. Unless the error stream is redirected
      to a separate file or stream, this property will include the
      error output.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">errorproperty</td>
    <td valign="top">The name of a property in which the standard error
      of the command should be stored.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">input</td>
    <td valign="top">A file from which the executed command's standard input
      is taken. This attribute is mutually exclusive with the
      <i>inputstring</i> attribute.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">inputstring</td>
    <td valign="top">A string which serves as the input stream for the
      executed command. This attribute is mutually exclusive with the
      <i>input</i> attribute.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">inputencoding</td>
    <td valign="top">The input encoding.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">outputencoding</td>
    <td valign="top">The output encoding.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">errorencoding</td>
    <td valign="top">The error encoding.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">alwayslog</td>
    <td valign="top">Always send to the log in addition to
        any other destination. <i>Since Ant 1.6.3</i>.
    </td>
    <td align="center" valign="top">No, default is <code>false</code></td>
  </tr>
  <tr>
    <td valign="top">loginputstring</td>
    <td valign="top">Controls the display of <i>inputstring</i>'s value in
        log messages. Set to <code>false</code> when sending sensitive data
        (e.g. passwords) to external processes. <i>Since Ant 1.6.3</i>.
    </td>
    <td align="center" valign="top">No, default is <code>true</code></td>
  </tr>
  <tr>
    <td valign="top">binaryOutput</td>
    <td valign="top">When set to true Ant will not try to split the
      output into lines - which it will usually do in order to separate
      error from normal output.  This setting will not prevent binary
      output from getting corrupted if you also specify filter chains.
      <i>Since Ant 1.9.4</i>.
    </td>
    <td align="center" valign="top">No, default is <code>false</code></td>
  </tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>inputmapper</h4>
<p>A single <a href="./mapper.html">File Mapper</a> used to redirect process
input.  Multiple mapping results should concatenate all mapped files as input.
Mapping will ordinarily be performed on a task-specified sourcefile;
consult the documentation of the individual task for more details.
A nested <code>&lt;inputmapper&gt;</code> is not compatible with either of the
<i>input</i> or <i>inputstring</i> attributes.</p>
<h4>outputmapper</h4>
<p>A single <a href="./mapper.html">File Mapper</a> used to redirect process
output.  Mapping will ordinarily be performed on a task-specified sourcefile;
consult the documentation of the individual task for more details.
A nested <code>&lt;outputmapper&gt;</code> is not compatible with the
<i>output</i> attribute.</p>
<h4>errormapper</h4>
<p>A single <a href="./mapper.html">File Mapper</a> used to redirect error
output.  Mapping will ordinarily be performed on a task-specified sourcefile;
consult the documentation of the individual task for more details.
A nested <code>&lt;errormapper&gt;</code> is not compatible with the
<i>error</i> attribute.</p>
<h4>inputfilterchain</h4>
<p>A <a href="./filterchain.html">FilterChain</a> can be
applied to the process input.</p>
<h4>outputfilterchain</h4>
<p>A <a href="./filterchain.html">FilterChain</a> can be
applied to the process output.</p>
<h4>errorfilterchain</h4>
<p>A <a href="./filterchain.html">FilterChain</a> can be
applied to the error output.</p>
<h3>Usage</h3>
Tasks known to support I/O redirection:
<ul>
<li><a href="../Tasks/exec.html">Exec</a></li>
<li><a href="../Tasks/apply.html">Apply</a></li>
<li><a href="../Tasks/java.html">Java</a></li>
</ul>
<p>The expected behavior of a <code>&lt;redirector&gt;</code> is to a great degree
dependent on the supporting task.  Any possible points of confusion
should be noted at the task level.</p>


</body>
</html>