Apache ANT Tasks Tutorial
Selected Reading
- Ant Tasks - Discussion
- Ant Tasks - Useful Resources
- Ant Tasks - Quick Guide
- ANT Tasks -JAR
- ANT Tasks - Zip
- ANT Tasks - WAR
- ANT Tasks - Sleep
- ANT Tasks - Move
- ANT Tasks - MkDir
- ANT Tasks - LoadFile
- ANT Tasks - Length
- ANT Tasks - Javac
- ANT Tasks - Java
- ANT Tasks - Import
- ANT Tasks - Fail
- ANT Tasks - EAR
- ANT Tasks - Delete
- ANT Tasks - Copy
- ANT Tasks - Condition
- ANT Tasks - Concat
- ANT Tasks - Chmod
- ANT Tasks - GUnzip
- ANT Tasks - GZip
- ANT Tasks - BaseName
- ANT Tasks - Environment Setup
- ANT Tasks - Introduction
- ANT Tasks - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
ANT Tasks - LoadFile
Apache Ant Tasks - LoadFile
Description
Loadfile task loads a file and sets its content into property.
Properties
Sr.No | Attributes & Description |
---|---|
1 | srcFile Source File. |
2 | Property Property to save to. |
3 | Encoding Encoding to use when loading the file. |
4 | failonerror Whether to halt the build on failure. |
5 | Quiet Do not display a diagnostic message (unless Apache Ant has been invoked with the -verbose or -debug switches) or modify the exit status to reflect an error. Setting this to true imppes setting failonerror to false. |
Usage
Create message.txt with the following content −
Welcome to tutorialspoint.com
Example
Create build.xml with the following content −
<?xml version="1.0"?> <project name="TutorialPoint" default="info"> <loadfile property="message" srcFile="message.txt"/> <target name="info"> <echo message="${message}"/> </target> </project>
Output
Running Ant on the above build file produces the following output −
F: utorialspointant>ant Buildfile: F: utorialspointantuild.xml info: [echo] Welcome to tutorialspoint.com BUILD SUCCESSFUL Total time: 0 secondsAdvertisements