alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Ant example source code file (concat.xml)

This example Ant source code file (concat.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Ant tags/keywords

cr, cr, lf, lf, macos, macos, x, x

The concat.xml source code

<?xml version="1.0"?>
<project default="cleanup" basedir=".">

  <target name="init">
    <mkdir dir="result" />
    <echo file="result/prepend.txt" message="this-should-be-the-first-line${line.separator}"/>
    <echo file="result/append.txt" message="this-should-be-the-last-line${line.separator}"/>
    <copy file="input/head-tail.test" tofile="input/concatfilter.test"/>
    <fixcrlf srcDir="input" includes="concatfilter.test"/>
    <!-- to be consistent on MacOS X.  fixcrlf uses CR while line.sep is LF -->
    <fixcrlf srcDir="result" includes="append.txt,prepend.txt"/>
  </target>

  <target name="cleanup">
    <delete dir="result"/>
    <delete>
      <fileset dir="input" includes="concatfilter.test"/>
    </delete>
  </target>


  <target name="testFilterReaderNoArgs" depends="init">
    <copy file="input/concatfilter.test"
          tofile="result/concat.FilterReaderNoArgs.test">
      <filterchain>
        <filterreader classname="org.apache.tools.ant.filters.ConcatFilter"/>
      </filterchain>
    </copy>
  </target>

  <target name="testFilterReaderPrepend" depends="init">
    <copy file="input/concatfilter.test"
          tofile="result/concat.FilterReaderPrepend.test">
      <filterchain>
        <filterreader classname="org.apache.tools.ant.filters.ConcatFilter">
          <param name="prepend" value="result/prepend.txt"/>
        </filterreader>
      </filterchain>
    </copy>
  </target>

  <target name="testFilterReaderAppend" depends="init">
    <copy file="input/concatfilter.test"
          tofile="result/concat.FilterReaderAppend.test">
      <filterchain>
        <filterreader classname="org.apache.tools.ant.filters.ConcatFilter">
          <param name="append" value="result/append.txt"/>
        </filterreader>
      </filterchain>
    </copy>
  </target>

  <target name="testFilterReaderPrependAppend" depends="init">
    <copy file="input/concatfilter.test"
          tofile="result/concat.FilterReaderPrependAppend.test">
      <filterchain>
        <filterreader classname="org.apache.tools.ant.filters.ConcatFilter">
          <param name="prepend" value="result/prepend.txt"/>
          <param name="append"  value="result/append.txt"/>
        </filterreader>
      </filterchain>
    </copy>
  </target>

  <target name="testConcatFilter" depends="init">
    <typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/>
    <copy file="input/concatfilter.test"
          tofile="result/concat.ConcatFilter.test">
      <filterchain>
        <concatfilter/>
      </filterchain>
    </copy>
  </target>

  <target name="testConcatFilterPrepend" depends="init">
    <typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/>
    <copy file="input/concatfilter.test"
          tofile="result/concat.ConcatFilterPrepend.test">
      <filterchain>
        <concatfilter prepend="result/prepend.txt"/>
      </filterchain>
    </copy>
  </target>

  <target name="testConcatFilterAppend" depends="init">
    <typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/>
    <copy file="input/concatfilter.test"
          tofile="result/concat.ConcatFilterAppend.test">
      <filterchain>
        <concatfilter append="result/append.txt"/>
      </filterchain>
    </copy>
  </target>

  <target name="testConcatFilterPrependAppend" depends="init">
    <typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/>
    <copy file="input/concatfilter.test"
          tofile="result/concat.ConcatFilterPrependAppend.test">
      <filterchain>
        <concatfilter prepend="result/prepend.txt" append="result/append.txt"/>
      </filterchain>
    </copy>
  </target>

</project>

Other Ant examples (source code examples)

Here is a short list of links related to this Ant concat.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.