1 | <html>
|
---|
2 | <head>
|
---|
3 | <title>LoadFile Task</title>
|
---|
4 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
5 | </head>
|
---|
6 |
|
---|
7 | <body>
|
---|
8 |
|
---|
9 |
|
---|
10 | <h2><a name="loadfile">LoadFile</a></h2>
|
---|
11 | <h3>Description</h3>
|
---|
12 | <p>
|
---|
13 | Load a text file into a single property. Unless an encoding is specified,
|
---|
14 | the encoding of the current locale is used.
|
---|
15 |
|
---|
16 | </p>
|
---|
17 |
|
---|
18 | <h3>Parameters</h3>
|
---|
19 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
20 | <tr>
|
---|
21 | <td valign="top"><b>Attribute</b></td>
|
---|
22 | <td valign="top"><b>Description</b></td>
|
---|
23 | <td align="center" valign="top"><b>Required</b></td>
|
---|
24 | </tr>
|
---|
25 | <tr>
|
---|
26 | <td valign="top">srcFile</td>
|
---|
27 | <td valign="top">source file</td>
|
---|
28 | <td valign="top" align="center">Yes</td>
|
---|
29 | </tr>
|
---|
30 | <tr>
|
---|
31 | <td valign="top">property</td>
|
---|
32 | <td valign="top">property to save to</td>
|
---|
33 | <td valign="top" align="center">Yes</td>
|
---|
34 | </tr>
|
---|
35 | <tr>
|
---|
36 | <td valign="top">encoding</td>
|
---|
37 | <td valign="top">encoding to use when loading the file</td>
|
---|
38 | <td align="center" valign="top">No</td>
|
---|
39 | </tr>
|
---|
40 | <tr>
|
---|
41 | <td valign="top">failonerror</td>
|
---|
42 | <td valign="top">Whether to halt the build on failure</td>
|
---|
43 | <td align="center" valign="top">No, default "true"</td>
|
---|
44 | </tr>
|
---|
45 | </table>
|
---|
46 | <p>
|
---|
47 | The LoadFile task supports nested <a href="../CoreTypes/filterchain.html">
|
---|
48 | FilterChain</a>s.
|
---|
49 |
|
---|
50 | <h3>Examples</h3>
|
---|
51 | <pre> <loadfile property="message"
|
---|
52 | srcFile="message.txt"/>
|
---|
53 | </pre>
|
---|
54 | Load file message.txt into property "message"; an <tt><echo></tt>
|
---|
55 | can print this.
|
---|
56 |
|
---|
57 | <pre> <loadfile property="encoded-file"
|
---|
58 | srcFile="loadfile.xml"
|
---|
59 | encoding="ISO-8859-1"/>
|
---|
60 | </pre>
|
---|
61 | Load a file using the latin-1 encoding
|
---|
62 |
|
---|
63 | <pre> <loadfile
|
---|
64 | property="optional.value"
|
---|
65 | srcFile="optional.txt"
|
---|
66 | failonerror="false"/>
|
---|
67 | </pre>
|
---|
68 | Load a file, don't fail if it is missing (a message is printed, though)
|
---|
69 |
|
---|
70 | <pre> <loadfile
|
---|
71 | property="mail.recipients"
|
---|
72 | srcFile="recipientlist.txt">
|
---|
73 | <filterchain>
|
---|
74 | <<a href="../CoreTypes/filterchain.html#striplinebreaks">striplinebreaks</a>/>
|
---|
75 | </filterchain>
|
---|
76 | </loadfile>
|
---|
77 | </pre>
|
---|
78 | Load a property which can be used as a parameter for another task (in this case mail),
|
---|
79 | merging lines to ensure this happens.
|
---|
80 |
|
---|
81 | <pre> <loadfile
|
---|
82 | property="system.configuration.xml"
|
---|
83 | srcFile="configuration.xml">
|
---|
84 | <filterchain>
|
---|
85 | <<a href="../CoreTypes/filterchain.html#expandproperties">expandproperties</a>/>
|
---|
86 | </filterchain>
|
---|
87 | </loadfile>
|
---|
88 | </pre>
|
---|
89 | Load an XML file into a property, expanding all properties declared
|
---|
90 | in the file in the process.
|
---|
91 |
|
---|
92 |
|
---|
93 | <hr>
|
---|
94 |
|
---|
95 | <p align="center">Copyright © 2001-2002,2004 The Apache Software Foundation. All rights
|
---|
96 | Reserved.</p>
|
---|
97 |
|
---|
98 | </body>
|
---|
99 | </html>
|
---|
100 |
|
---|