2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
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.
|
|
|
|
-->
|
2001-12-25 06:14:40 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-12-20 01:46:23 +00:00
|
|
|
<title>LoadFile Task</title>
|
2001-12-25 06:14:40 +00:00
|
|
|
</head>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
<body>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
<h2><a name="loadfile">LoadFile</a></h2>
|
|
|
|
<h3>Description</h3>
|
2002-12-20 01:46:23 +00:00
|
|
|
<p>
|
2005-11-25 08:47:50 +00:00
|
|
|
Specialization of <a href="loadresource.html">loadresource</a> that
|
|
|
|
works on files exclusively and provides a srcFile attribute for
|
|
|
|
convenience. Unless an encoding is specified, the encoding of the
|
|
|
|
current locale is used.
|
2002-12-20 01:46:23 +00:00
|
|
|
</p>
|
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
<h3>Parameters</h3>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
2002-12-20 01:46:23 +00:00
|
|
|
<tr>
|
2001-12-25 06:14:40 +00:00
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
2002-02-01 07:23:56 +00:00
|
|
|
<tr>
|
2001-12-25 06:14:40 +00:00
|
|
|
<td valign="top">srcFile</td>
|
|
|
|
<td valign="top">source file</td>
|
|
|
|
<td valign="top" align="center">Yes</td>
|
|
|
|
</tr>
|
2002-02-01 07:23:56 +00:00
|
|
|
<tr>
|
2001-12-25 06:14:40 +00:00
|
|
|
<td valign="top">property</td>
|
|
|
|
<td valign="top">property to save to</td>
|
|
|
|
<td valign="top" align="center">Yes</td>
|
|
|
|
</tr>
|
2002-02-01 07:23:56 +00:00
|
|
|
<tr>
|
2001-12-25 06:14:40 +00:00
|
|
|
<td valign="top">encoding</td>
|
|
|
|
<td valign="top">encoding to use when loading the file</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
2002-02-01 07:23:56 +00:00
|
|
|
<tr>
|
2001-12-25 06:14:40 +00:00
|
|
|
<td valign="top">failonerror</td>
|
|
|
|
<td valign="top">Whether to halt the build on failure</td>
|
|
|
|
<td align="center" valign="top">No, default "true"</td>
|
|
|
|
</tr>
|
2006-11-13 21:11:42 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">quiet</td>
|
|
|
|
<td valign="top">Do not display a diagnostic message (unless Ant has been
|
|
|
|
invoked with the <code>-verbose</code> or <code>-debug</code>
|
|
|
|
switches) or modify the exit status to reflect an error. Setting this to
|
|
|
|
"true" implies setting failonerror to "false".
|
|
|
|
<em>Since Ant 1.7.0.</em>
|
|
|
|
</td>
|
|
|
|
<td align="center" valign="top">No, default "false"</td>
|
|
|
|
</tr>
|
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
</table>
|
2002-12-20 01:46:23 +00:00
|
|
|
<p>
|
|
|
|
The LoadFile task supports nested <a href="../CoreTypes/filterchain.html">
|
|
|
|
FilterChain</a>s.
|
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
<h3>Examples</h3>
|
2002-12-20 01:46:23 +00:00
|
|
|
<pre> <loadfile property="message"
|
|
|
|
srcFile="message.txt"/>
|
|
|
|
</pre>
|
|
|
|
Load file message.txt into property "message"; an <tt><echo></tt>
|
2005-11-25 08:47:50 +00:00
|
|
|
can print this. This is identical to
|
|
|
|
<pre> <loadresource property="message">
|
|
|
|
<file file="message.txt"/>
|
|
|
|
</loadresource>
|
|
|
|
</pre>
|
|
|
|
</p>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
|
|
|
<pre> <loadfile property="encoded-file"
|
|
|
|
srcFile="loadfile.xml"
|
|
|
|
encoding="ISO-8859-1"/>
|
|
|
|
</pre>
|
|
|
|
Load a file using the latin-1 encoding
|
|
|
|
|
|
|
|
<pre> <loadfile
|
|
|
|
property="optional.value"
|
|
|
|
srcFile="optional.txt"
|
|
|
|
failonerror="false"/>
|
|
|
|
</pre>
|
|
|
|
Load a file, don't fail if it is missing (a message is printed, though)
|
|
|
|
|
|
|
|
<pre> <loadfile
|
|
|
|
property="mail.recipients"
|
|
|
|
srcFile="recipientlist.txt">
|
|
|
|
<filterchain>
|
|
|
|
<<a href="../CoreTypes/filterchain.html#striplinebreaks">striplinebreaks</a>/>
|
|
|
|
</filterchain>
|
|
|
|
</loadfile>
|
|
|
|
</pre>
|
|
|
|
Load a property which can be used as a parameter for another task (in this case mail),
|
|
|
|
merging lines to ensure this happens.
|
|
|
|
|
|
|
|
<pre> <loadfile
|
|
|
|
property="system.configuration.xml"
|
|
|
|
srcFile="configuration.xml">
|
|
|
|
<filterchain>
|
|
|
|
<<a href="../CoreTypes/filterchain.html#expandproperties">expandproperties</a>/>
|
|
|
|
</filterchain>
|
|
|
|
</loadfile>
|
|
|
|
</pre>
|
|
|
|
Load an XML file into a property, expanding all properties declared
|
|
|
|
in the file in the process.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
2002-12-20 01:46:23 +00:00
|
|
|
|