- Apache ANT Tasks Tutorial
- ANT Tasks - Home
- ANT Tasks - Introduction
- ANT Tasks - Environment Setup
- Apache ANT Tasks Examples
- ANT Tasks - BaseName
- ANT Tasks - GZip
- ANT Tasks - GUnzip
- ANT Tasks - Chmod
- ANT Tasks - Concat
- ANT Tasks - Condition
- ANT Tasks - Copy
- ANT Tasks - Delete
- ANT Tasks - EAR
- ANT Tasks - Fail
- ANT Tasks - Import
- ANT Tasks - Java
- ANT Tasks - Javac
- ANT Tasks - Length
- ANT Tasks - LoadFile
- ANT Tasks - MkDir
- ANT Tasks - Move
- ANT Tasks - Sleep
- ANT Tasks - WAR
- ANT Tasks - Zip
- ANT Tasks -JAR
- Apache ANT Tasks Useful Resources
- Ant Tasks - Quick Guide
- Ant Tasks - Useful Resources
- Ant Tasks - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Apache Ant Tasks - Concat
Concat task concatenate one or more resources to a single file or to console. The destination file is created if it does not exist unless the resource list is empty and ignoreempty flag is true.
|Sr.No||Attributes & Description|
The destination file for the concatenated stream. If not specified the console will be used instead.
Specifies whether or not the file specified by destfile should be appended.
Specifies whether or not the file specified by destfile should be written to even if it is newer than all source files.
Overwrite read-only destination files.
Specifies the encoding for the input files.
The encoding to use when writing the output file.
Specifies whether or not to check if each file concatenated is terminated by a new line. If this attribute is yes a new line will be appended to the stream if the file did not end in a new line.
Specifies what the end of line character are for use by the fixlastline attribute.
If this attribute is set to true, the task concatenates the files in a byte by byte fashion. If this attribute is false, concat will not normally work for binary files due to character encoding issues. If this option is set to true, the destfile attribute must be set, and the task cannot used nested text. Also the attributes encoding, outputencoding, filelastline cannot be used.
If this attribute is set to true, the task applies the filterchain to each input after applying fixlastline. If this attribute is false, concat will apply the filterchain only once to the already concatenated inputs. Filtering of header and footer is not affected by this setting.
Specifies whether or not the file specified by destfile should be created if the source resource list is empty.
Specifies the name reported if this task is exposed as a resource.
Create build.xml with the following content −
<?xml version="1.0"?> <project name="TutorialPoint" default="info"> <target name="info"> <concat> <fileset dir="messages" includes="*test*"/> </concat> </target> </project>
Above script will read messages folder and concatenates contents of file having test in their name and show them on console.
Let's create a test.txt with content as "Welcome to tutorialspoint.com" in messages folder. Now running Ant on the above build file produces the following output −
F:\tutorialspoint\ant>ant Buildfile: F:\tutorialspoint\ant\build.xml info: [concat] Welcome to tutorialspoint.com BUILD SUCCESSFUL Total time: 0 seconds