<loadFile>
The <loadfile> task offers the simple facility of loading the contents of a text file to a property. Table 4.54 displays the associated attributes for the task.
Attributes | Description |
---|---|
Required | |
property | The property to set with the contents of the file. |
srcfile | The file to load. |
Optional | |
encoding | Specifies the encoding to use when loading the file. Defaults to the current locale. |
failonerror | If true, the build will stop if an error occurs. Defaults to true. |
Nested Elements
Nested <filterchain> elements are supported.
Examples
This example will load the contents of the foo.txt file to the bar property. If the file does not exist, the build will halt.
<loadfile srcfile="foo.txt" property="bar"/> ...
Get Ant Developer’s Handbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.