Home » Apache Ant LoadFile Task

Apache Ant LoadFile Task

by Online Tutorials Library

Apache Ant LoadFile Task

This task is used to load file into a property. It works on files and provides a srcFile attribute for ease. It uses default encoding current locale unless other one is specified.

It uses various attributes which are given below.

Apache Ant LoadFile Task Attributes

Attribute Description Required
srcFile It is used to specify source file. Yes
property A property to where to save file. Yes
encoding To set encoding of the file. No
failonerror Whether to halt the build on failure or not. No
quiet It prevents to display a diagnostic message. No

Lets have some examples to understand it’s functionalities.

Apache Ant LoadFile Task Example

The above code will produce the content of abc.txt file.

Specifying encoding while reading file.

Set failonerror to get error information

You may also like