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 | <head>
|
---|
19 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
20 | <title>LoadFile Task</title>
|
---|
21 | </head>
|
---|
22 |
|
---|
23 | <body>
|
---|
24 |
|
---|
25 |
|
---|
26 | <h2><a name="loadfile">LoadFile</a></h2>
|
---|
27 | <h3>Description</h3>
|
---|
28 | <p>
|
---|
29 | Specialization of <a href="loadresource.html">loadresource</a> that
|
---|
30 | works on files exclusively and provides a srcFile attribute for
|
---|
31 | convenience. Unless an encoding is specified, the encoding of the
|
---|
32 | current locale is used.
|
---|
33 | </p>
|
---|
34 |
|
---|
35 | <h3>Parameters</h3>
|
---|
36 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
37 | <tr>
|
---|
38 | <td valign="top"><b>Attribute</b></td>
|
---|
39 | <td valign="top"><b>Description</b></td>
|
---|
40 | <td align="center" valign="top"><b>Required</b></td>
|
---|
41 | </tr>
|
---|
42 | <tr>
|
---|
43 | <td valign="top">srcFile</td>
|
---|
44 | <td valign="top">source file</td>
|
---|
45 | <td valign="top" align="center">Yes</td>
|
---|
46 | </tr>
|
---|
47 | <tr>
|
---|
48 | <td valign="top">property</td>
|
---|
49 | <td valign="top">property to save to</td>
|
---|
50 | <td valign="top" align="center">Yes</td>
|
---|
51 | </tr>
|
---|
52 | <tr>
|
---|
53 | <td valign="top">encoding</td>
|
---|
54 | <td valign="top">encoding to use when loading the file</td>
|
---|
55 | <td align="center" valign="top">No</td>
|
---|
56 | </tr>
|
---|
57 | <tr>
|
---|
58 | <td valign="top">failonerror</td>
|
---|
59 | <td valign="top">Whether to halt the build on failure</td>
|
---|
60 | <td align="center" valign="top">No, default "true"</td>
|
---|
61 | </tr>
|
---|
62 | <tr>
|
---|
63 | <td valign="top">quiet</td>
|
---|
64 | <td valign="top">Do not display a diagnostic message (unless Ant has been
|
---|
65 | invoked with the <code>-verbose</code> or <code>-debug</code>
|
---|
66 | switches) or modify the exit status to reflect an error. Setting this to
|
---|
67 | "true" implies setting failonerror to "false".
|
---|
68 | <em>Since Ant 1.7.0.</em>
|
---|
69 | </td>
|
---|
70 | <td align="center" valign="top">No, default "false"</td>
|
---|
71 | </tr>
|
---|
72 |
|
---|
73 | </table>
|
---|
74 | <p>
|
---|
75 | The LoadFile task supports nested <a href="../CoreTypes/filterchain.html">
|
---|
76 | FilterChain</a>s.
|
---|
77 |
|
---|
78 | <h3>Examples</h3>
|
---|
79 | <pre> <loadfile property="message"
|
---|
80 | srcFile="message.txt"/>
|
---|
81 | </pre>
|
---|
82 | Load file message.txt into property "message"; an <tt><echo></tt>
|
---|
83 | can print this. This is identical to
|
---|
84 | <pre> <loadresource property="message">
|
---|
85 | <file file="message.txt"/>
|
---|
86 | </loadresource>
|
---|
87 | </pre>
|
---|
88 | </p>
|
---|
89 |
|
---|
90 | <pre> <loadfile property="encoded-file"
|
---|
91 | srcFile="loadfile.xml"
|
---|
92 | encoding="ISO-8859-1"/>
|
---|
93 | </pre>
|
---|
94 | Load a file using the latin-1 encoding
|
---|
95 |
|
---|
96 | <pre> <loadfile
|
---|
97 | property="optional.value"
|
---|
98 | srcFile="optional.txt"
|
---|
99 | failonerror="false"/>
|
---|
100 | </pre>
|
---|
101 | Load a file, don't fail if it is missing (a message is printed, though)
|
---|
102 |
|
---|
103 | <pre> <loadfile
|
---|
104 | property="mail.recipients"
|
---|
105 | srcFile="recipientlist.txt">
|
---|
106 | <filterchain>
|
---|
107 | <<a href="../CoreTypes/filterchain.html#striplinebreaks">striplinebreaks</a>/>
|
---|
108 | </filterchain>
|
---|
109 | </loadfile>
|
---|
110 | </pre>
|
---|
111 | Load a property which can be used as a parameter for another task (in this case mail),
|
---|
112 | merging lines to ensure this happens.
|
---|
113 |
|
---|
114 | <pre> <loadfile
|
---|
115 | property="system.configuration.xml"
|
---|
116 | srcFile="configuration.xml">
|
---|
117 | <filterchain>
|
---|
118 | <<a href="../CoreTypes/filterchain.html#expandproperties">expandproperties</a>/>
|
---|
119 | </filterchain>
|
---|
120 | </loadfile>
|
---|
121 | </pre>
|
---|
122 | Load an XML file into a property, expanding all properties declared
|
---|
123 | in the file in the process.
|
---|
124 |
|
---|
125 |
|
---|
126 |
|
---|
127 |
|
---|
128 | </body>
|
---|
129 | </html>
|
---|
130 |
|
---|