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
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="loadfile">LoadFile</h2>
|
2001-12-25 06:14:40 +00:00
|
|
|
<h3>Description</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Specialization of <a href="loadresource.html">loadresource</a> that works on files exclusively
|
|
|
|
and provides a <var>srcFile</var> attribute for convenience. Unless an <var>encoding</var> is
|
|
|
|
specified, the encoding of the current locale is used.</p>
|
|
|
|
<p>If the resource content is empty (maybe after processing a <code>filterchain</code>) the property
|
|
|
|
is not set.</p>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2002-12-20 01:46:23 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2001-12-25 06:14:40 +00:00
|
|
|
</tr>
|
2002-02-01 07:23:56 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>srcFile</td>
|
|
|
|
<td>source file</td>
|
|
|
|
<td>Yes</td>
|
2001-12-25 06:14:40 +00:00
|
|
|
</tr>
|
2002-02-01 07:23:56 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>property</td>
|
|
|
|
<td>property to save to</td>
|
|
|
|
<td>Yes</td>
|
2001-12-25 06:14:40 +00:00
|
|
|
</tr>
|
2002-02-01 07:23:56 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>encoding</td>
|
|
|
|
<td>encoding to use when loading the file</td>
|
|
|
|
<td>No</td>
|
2001-12-25 06:14:40 +00:00
|
|
|
</tr>
|
2002-02-01 07:23:56 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>failonerror</td>
|
|
|
|
<td>Whether to halt the build on failure</td>
|
|
|
|
<td>No; default <q>true</q></td>
|
2001-12-25 06:14:40 +00:00
|
|
|
</tr>
|
2006-11-13 21:11:42 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>quiet</td>
|
|
|
|
<td>Do not display a diagnostic message (unless Apache Ant has been invoked with
|
2018-03-10 20:17:33 +01:00
|
|
|
the <kbd>-verbose</kbd> or <kbd>-debug</kbd> switches) or modify the exit status to
|
2018-02-28 07:58:59 +01:00
|
|
|
reflect an error. Setting this to <q>true</q> implies setting <var>failonerror</var>
|
|
|
|
to <q>false</q>. <em>Since Ant 1.7.0</em>.
|
2006-11-13 21:11:42 +00:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; default <q>false</q></td>
|
2006-11-13 21:11:42 +00:00
|
|
|
</tr>
|
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
</table>
|
2018-03-08 07:43:53 +01:00
|
|
|
<p>The LoadFile task supports nested <a href="../Types/filterchain.html">FilterChain</a>s.</p>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
<h3>Examples</h3>
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Load file <samp>message.txt</samp> into property <code>message</code>;
|
|
|
|
an <code><echo></code> can print this.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre>
|
|
|
|
<loadfile property="message"
|
|
|
|
srcFile="message.txt"/></pre>
|
2018-05-15 09:51:58 +02:00
|
|
|
|
|
|
|
<p>The above is identical to</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre>
|
|
|
|
<loadresource property="message">
|
|
|
|
<file file="message.txt"/>
|
|
|
|
</loadresource></pre>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Load a file using the Latin-1 encoding</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre>
|
|
|
|
<loadfile property="encoded-file"
|
|
|
|
srcFile="loadfile.xml"
|
|
|
|
encoding="ISO-8859-1"/></pre>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Load a file, don't fail if it is missing (a message is printed, though)</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre>
|
|
|
|
<loadfile property="optional.value"
|
|
|
|
srcFile="optional.txt"
|
|
|
|
failonerror="false"/></pre>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Load a property which can be used as a parameter for another task (in this
|
|
|
|
case <code>mail</code>), merging lines to ensure this happens.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre>
|
|
|
|
<loadfile property="mail.recipients"
|
|
|
|
srcFile="recipientlist.txt">
|
|
|
|
<filterchain>
|
2010-05-26 20:33:51 +00:00
|
|
|
<<a href="../Types/filterchain.html#striplinebreaks">striplinebreaks</a>/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</filterchain>
|
|
|
|
</loadfile></pre>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Load an XML file into a property, expanding all properties declared in the file in the
|
|
|
|
process.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre>
|
|
|
|
<loadfile property="system.configuration.xml"
|
|
|
|
srcFile="configuration.xml">
|
|
|
|
<filterchain>
|
|
|
|
<<a href="../Types/filterchain.html#expandproperties">expandproperties</a>/>
|
|
|
|
</filterchain>
|
|
|
|
</loadfile></pre>
|
2002-12-20 01:46:23 +00:00
|
|
|
|
2001-12-25 06:14:40 +00:00
|
|
|
</body>
|
|
|
|
</html>
|