64
Apache Ant Concat Task
Concatenation is used to concat one or more files to a single file. A new file will be created if it does not exist unless the resource list is empty and ignoreempty is true.
Since Apache Ant 1.7.1, this task can be used as a resource collection that will return exactly one resource.
Resource collections are used to select which resources are to be concatenated. There is no singular attribute to specify a single resource to concatenation file.
Apache Ant Concat Task Attributes
Attribute | Description | Required |
---|---|---|
destfile | The destination file for the concatenated stream. | No |
append | It specifies whether or not the file specified by destfile should be appended. | No |
force | It specifies whether or not the file specified by destfile should be written. | No |
overwrite | It specifies whether or not the file specified by destfile should be written. | No |
forceReadOnly | It overwrites read-only destination files. | No |
encoding | It specifies the encoding for the input files. | No |
outputencoding | The encoding to use when writing the output file. | No |
fixlastline | It specifies whether or not to check if each file concatenated is terminated by a new line. | No |
eol | It specifies what the end of line character are for use by the fixlastline attribute. | No |
binary | If this attribute is set to true, the task concatenates the files in a byte by byte fashion. | No |
ignoreempty | Specifies whether or not the file specified by destfile should be created if the source resource list is empty. | No; defaults to true |
resourcename | Specifies the name reported if this task is exposed as a resource. | No |
Apache Ant Concat Example
Concatenate a string to a file:
Concatenate a series of files to the console:
Next TopicApache Ant Condition Task