Load a text file into a single property. Unless an encoding is specified, the encoding of the current locale is used.
| Attribute | Description | Required |
| srcFile | source file | Yes |
| property | property to save to | Yes |
| encoding | encoding to use when loading the file | No |
| failonerror | Whether to halt the build on failure | No, default "true" |
The LoadFile task supports nested FilterChains.
<loadfile property="message"Load file message.txt into property "message"; an <echo>can print this.
srcFile="message.txt"/>
<loadfile property="encoded-file"Load a file using the latin-1 encoding
srcFile="loadfile.xml"
encoding="ISO-8859-1"/>
<loadfileLoad a file, don't fail if it is missing (a message is printed, though)
property="optional.value"
srcFile="optional.txt"
failonerror="false"/>
<loadfileLoad a property which can be used as a parameter for another task (in this case mail), merging lines to ensure this happens.
property="mail.recipients"
srcFile="recipientlist.txt">
<filterchain>
<striplinebreaks/>
</filterchain>
</loadfile>
<loadfileLoad an XML file into a property, expanding all properties declared in the file in the process.
property="system.configuration.xml"
srcFile="configuration.xml">
<filterchain>
<expandproperties/>
</filterchain>
</loadfile>
Copyright © 2001-2002 Apache Software Foundation. All rights Reserved.