<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<article id="Ant">
  <articleinfo>
    <title>ANT Tutorial</title>
    <author>
      <firstname>Ashley</firstname>
      <othername>J.S</othername>
      <surname>Mills</surname>
      <affiliation>
 <address><email>ashley@ashleymills.com</email></address>
      </affiliation>
    </author>

    <copyright>
      <year>2005</year>
      <holder role="mailto:ashley@ashleymills.com">The University Of Birmingham</holder>
    </copyright>
  </articleinfo>

  <sect1 id="Ant-Introduction"><title>Introduction</title>
    <para>
       Imagine that you are working on a large project.  The project is a Java project and consists of many <filename>.java</filename> files.  It consists of classes that are dependent on other classes and classes which are stubs or drivers, they are situated in multiple directories and the output files must go into multiple directories too, you have various project build routes for different applications and at the moment are coordinating all of this manually or using some other build utility which doesn't do what you want it to so many hours are spent changing directories compiling individual files and so on...  Now, imagine if their was a tool that could alleviate the stress and hassle you are experiencing, OK, enough of the rhetoric, this tool exists, it is called ANT.  For a nice definition of what Ant is, see <ulink url="http://jakarta.apache.org/ant/">http://jakarta.apache.org/ant/</ulink>.
    </para>

    <para> 
      Ant (originally an acronym for Another Neat Tool), is a build tool with special support for the Java programming language but can be used for just about everything.  Ant is platform-independent; it is written purely in Java.  Ant is particularly good at automating complicated repetitive tasks and thus is well suited for automating standardised build processes.  Ant accepts instructions in the form of <acronym>XML</acronym> documents thus is extensible and easy to maintain.
    </para>
  </sect1>

  <sect1 id="Ant-Installation"><title>Ant Installation</title>
    <para>
      The documentation for the installation is written under the assumption that the reader has some experience of installing software on computers and knows how to change the operating environment of the particular operating system they are using. The documents entitled <ulink url="../winenvars/winenvarshome.html"><citetitle>Configuring A Windows Working Environment</citetitle></ulink> and <ulink url="../unixenvars/unixenvarshome.html"><citetitle>Configuring A Unix Working Environment</citetitle></ulink> are of use to people who need to know more.
    </para>

    <orderedlist>
      <listitem>
        <para>
          Download the binaries from <ulink url="http://jakarta.apache.org/ant/index.html">http://jakarta.apache.org/ant/index.html</ulink>, unzip them to a suitable directory. 
        </para>
      </listitem>
      <listitem>
        <para>Append <filename>/path/to/ant/bin</filename> to the <envar>PATH</envar> environment variable.</para>
      </listitem>
      <listitem>
        <para>
          Append the <filename>.jar</filename> files in <filename>/path/to/ant/lib/</filename> to the <envar>CLASSPATH</envar> environment variable. Set <envar>JAVA_HOME</envar> to point to the location of the JDK installation on the machine that the software is being installed on. Append <filename>/path/to/jdk/lib/*</filename> to the <envar>CLASSPATH</envar> environment variable.
        </para>
      </listitem>
    </orderedlist>

    <para>
      The installation instructions provided with the Ant software installation download are clear enough to warrant abstaining from writing any more about the installation here. Refer to <filename>/path/to/ant/docs/manual/install.html</filename>.
    </para>
  </sect1>

  <sect1 id="Ant-Basics"><title>Ant Basics</title>
    <para>
      An Ant build file comes in the form of an <acronym>XML</acronym> document, all that is required is a simple text editor to edit the build file(s). An editor that provides <acronym>XML</acronym> syntax highlighting is preferable.  The Ant installation comes with a <acronym>JAXP</acronym>-Compliant <acronym>XML</acronym> parser, this means that the installation of an external <acronym>XML</acronym> parser is not necessary.
    </para>

    <para>
      A simple Ant example is shown below followed by a set of instructions indicating how to use Ant. It is recommended that the reader follow these instructions to gain some experience in using Ant.
    </para>

    <example id="Ant-BasicExample"><title>Basic <filename>build.xml</filename> Example</title>
      <programlisting>&lt;?xml version=&quot;1.0&quot;?&gt; <co id="Ant-BasicExample-XmlPrologue"/>
&lt;project name=&quot;test&quot; default=&quot;compile&quot; basedir=&quot;.&quot;&gt; <co id="Ant-BasicExample-Project"/>

     &lt;property name=&quot;src&quot; value=&quot;.&quot;/&gt; <co id="Ant-BasicExample-Properties"/>
     &lt;property name=&quot;build&quot; value=&quot;build&quot;/&gt;

     &lt;target name=&quot;init&quot;&gt;  <co id="Ant-BasicExample-Targets"/>
          &lt;mkdir dir=&quot;${build}&quot;/&gt;
     &lt;/target&gt;

     &lt;target name=&quot;compile&quot; depends=&quot;init&quot;&gt; <co id="Ant-BasicExample-Depends"/>
          &lt;!-- Compile the java code --&gt;
          
          &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot;/&gt; <co id="Ant-BasicExample-Compile"/>
     &lt;/target&gt;
&lt;/project&gt;</programlisting>
    </example>

      <calloutlist>
        <callout arearefs="Ant-BasicExample-XmlPrologue">
          <para/>
          <programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;</programlisting>
          <para>
            Since Ant build files are <acronym>XML</acronym> files the document begins with an <acronym>XML</acronym> declaration which specifies which version of <acronym>XML</acronym> is in use, this is to allow for the possibility of automatic version recognition should it become necessary.
          </para>
        </callout>

        <callout arearefs="Ant-BasicExample-Project">
          <para/>
          <programlisting>&lt;project name=&quot;test&quot; default=&quot;compile&quot; basedir=&quot;.&quot;&gt;</programlisting>
          <para>
            The root element of an Ant build file is the project element, it has three attributes.
          </para>
          <itemizedlist>
            <listitem>
              <para>
                name: The name of the project, it can be any combination of alphanumeric characters that constitute valid <acronym>XML</acronym>.
              </para>
            </listitem>
            <listitem>
              <para>
                default: The default target to use when no target is specified, out of these three attributes <emphasis role="strong">default</emphasis> is the only <emphasis role="strong">required</emphasis> attribute.
              </para>
            </listitem>
            <listitem>
              <para>
                basedir: The base directory from which any relative directories used within the Ant build file are referenced from.  If this is omitted the parent directory of the build file will be used.
              </para>
            </listitem>
          </itemizedlist>
        </callout>

        <callout id="Ant-BasicExample-Callout3" arearefs="Ant-BasicExample-Properties">
          <para/>
          <programlisting>&lt;property name=&quot;src&quot; value=&quot;.&quot;/&gt;
&lt;property name=&quot;build&quot; value=&quot;build&quot;/&gt;</programlisting>
          <para>
            The property element allows the declaration of properties which are <emphasis>like</emphasis> user-definable variables available for use within an Ant build file.  The name attribute specifies the name of the property and the value attribute specifies the desired value of the property.  The name and value values are subject to standard <acronym>XML</acronym> constraints. In the markup shown above <emphasis>src</emphasis> has been assigned the value <emphasis role="strong">&quot;.&quot;</emphasis>.
          </para>

          <para>
            In order to reference a property defined in this manner one specifies the name between <emphasis role="strong">${</emphasis> and <emphasis role="strong">}</emphasis>, for example, to reference the value of <emphasis>src</emphasis> one uses <emphasis role="strong">${ src }</emphasis>. In the example, <emphasis>src</emphasis> is used later on to specify the location of the <filename>.java</filename> files to be processed.
          </para>
        </callout>

        <callout id="Ant-BasicExample-Callout4" arearefs="Ant-BasicExample-Targets">
          <para/>
          <programlisting>&lt;target name=&quot;init&quot;&gt;
     &lt;mkdir dir=&quot;${build}&quot;/&gt;
&lt;/target&gt;</programlisting>
          <para>
            The target element is used as a wrapper for a sequences of actions.  A target has a name, so that it can be referenced from elsewhere, either externally from the command line, or internally via the <emphasis>depends</emphasis> keyword, or through a direct call.  The target in the example is called &quot;init&quot; (initiate), it makes a directory using the <command>mkdir</command> element with the name specified by the <emphasis>build</emphasis> property defined in <link linkend="Ant-BasicExample-Callout3">three</link>.
          </para>

          <para>The target element has a number of possible attributes, unless otherwise specified, these are optional:</para>

          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="strong">name</emphasis>: The name of the target is used to reference it from elsewhere, it is subject to the constraints of <acronym>XML</acronym> well formed-ness. This is the <emphasis role="strong">only</emphasis> required attribute for the <emphasis>target</emphasis> element.
              </para>
            </listitem>

            <listitem>
              <para>
                <emphasis role="strong">depends</emphasis>: This is a comma separated list of all the targets on which this target depends, for example, <link linkend="Ant-BasicExample-Callout5">number 5</link> illustrates how <emphasis role="strong">compile</emphasis> <emphasis>depends</emphasis> on <emphasis role="strong">init</emphasis>, in other words, depends contains the list of the targets that must be executed prior to executing this target.
              </para>
            </listitem>

            <listitem>
              <para>
                <emphasis role="strong">if</emphasis>: This is a useful attribute which allows one to add a conditional attribute to a target based on the value of a property , for example, <emphasis role="strong">if=&quot;gui-ready&quot;</emphasis> could be used to only execute the encapsulating target's instructions if the property <emphasis>gui-ready</emphasis> was is (to any value).
              </para>
            </listitem>

            <listitem>
              <para>
                <emphasis role="strong">unless</emphasis>: This is the converse of <command>if</command>, for example, <emphasis role="strong">unless=&quot;gui-ready&quot;</emphasis> could be used to conditionally execute the contents of the encapsulating target. The targets' contents will be executed <emphasis>unless</emphasis> the the property <emphasis>gui-ready</emphasis> is set (to any value).
              </para>
            </listitem>

            <listitem>
              <para>
                <emphasis role="strong">description</emphasis>: This is a short description of the target.
              </para>
            </listitem>
          </itemizedlist>
        </callout>

        <callout id="Ant-BasicExample-Callout5" arearefs="Ant-BasicExample-Depends">
          <para/>
          <programlisting>&lt;target name=&quot;compile&quot; depends=&quot;init&quot;&gt;
     &lt;!-- Compile the java code --&gt;
     
     &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot;/&gt;
&lt;/target&gt;</programlisting>
          <para>
            As explained in <link linkend="Ant-BasicExample-Callout4">four</link>, depends allows one to specify other targets that must be executed prior to the execution of this target.  In the listing above <emphasis role="strong">depends=&quot;init&quot;</emphasis> is used to indicate that the <emphasis>compile</emphasis> target requires that the target named <emphasis>init</emphasis> be executed prior to executing the body of <emphasis>compile</emphasis>.
          </para>
        </callout>

        <callout arearefs="Ant-BasicExample-Compile">
          <para/>
          <programlisting>&lt;target name=&quot;compile&quot; depends=&quot;init&quot;&gt;
     &lt;!-- Compile the java code --&gt;
     
     &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot;/&gt;
&lt;/target&gt;</programlisting>
          <para>
            The <emphasis>javac</emphasis> element, as used above, is a <emphasis>task</emphasis>, tasks are performed in the body of a <emphasis>target</emphasis>, in this case, the source directory is specified by referencing the <emphasis>src</emphasis> property and the destination directory is specified by referencing the <emphasis>build</emphasis> property.  The example above causes <command>javac</command> to be executed, compiling all the <filename>.java</filename> files in the directory specified by the <emphasis>src</emphasis> property and placing the resultant <filename>.class</filename> files in the directory specified by the <emphasis>build</emphasis> property.
          </para>
        </callout>
      </calloutlist>

    <para>
      Copy the source code in <link linkend="Ant-BasicExample">the example</link> into a text editor and save the file as <filename>build.xml</filename>. Create a test directory and place the file in it.  Create some arbitrary <filename>.java</filename> file and place it in the same directory as <filename>build.xml</filename>. For convenience, here is an example <filename>.java</filename> file: <filename>test.java</filename>. Place the java file in the same directory as <filename>build.xml</filename>.
    </para>

    <programlisting>public class test {
   public static void main(String[] args) {
      System.out.println(&quot;Hello World!&quot;);
   }
}</programlisting>

    <para>Type the following at the commandline in the test directory:</para>
    
    <screen><userinput><command>ant</command> <option>-v</option></userinput></screen> 
    
    <para>
      This will create a directory called <filename>build</filename>, compile <filename>test.java</filename> and place the <filename>.class</filename> file created in the <filename>build</filename> directory.  The <option>-v</option> directs <command>ant</command> to be verbose.  This verbosity causes the command to echo lots of information, information that is not really necessary for most normal purposes. Execute the command sequence again. An example output message is shown below:
    </para>

    <screen>[javac] test.java omitted as /path/to/temp/build/test.class is up todate</screen>

    <para>
      A nice feature of Ant is that by default, only those <filename>.java</filename> input files that have a more recent timestamp than their corresponding <filename>.class</filename> output files will be compiled.
    </para>
  </sect1>

  <sect1 id="Ant-Typical-Project"><title>A Typical Project</title>
    <para>
      This section intends to provide and describe a typical Ant buildfile, such that, the example given could be easily modified to suit ones personal needs.
    </para>

    <para>When starting a project it is a good idea to follow the suggestion in the Ant documentation of using three directories:</para>

    <orderedlist>
      <listitem>
        <para>
          <filename>src</filename> : For project source files.
        </para>
      </listitem>
      <listitem>
        <para>
          <filename>build</filename> : For compiled/output files produced (by Ant). 
        </para>
      </listitem>
      <listitem>
        <para>
          <filename>lib</filename> : For class libraries and dependency files.
        </para>
      </listitem>
    </orderedlist>

    <para>Create a test directory and from within this, create the three directories described above.</para>

    <para>
      A simple Java program will be used to illustrate the use of Ant. Copy the following program into a file called <filename>UKLights.java</filename> and place it in the <filename>src</filename> directory:
    </para>

    <programlisting>import javax.swing.*;
import java.awt.*;
public class UKLights extends JFrame {

   public UKLights() {
      super(&quot;UKLights&quot;);
      ImageIcon icon = new ImageIcon(&quot;uklights.jpeg&quot;);
      getContentPane().add(new JLabel(icon));
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setSize(new Dimension(315,244));
      setVisible(true);
   }


   public static void main(String args[]) {
      new UKLights();
   }
}</programlisting>

    <para>
      Alternatively, download the file from here: <ulink url="files/uklights/UKLights.java">UKLights.java</ulink>. The program imports the auxilliary Java classes and defines two methods. The first method is the constructor for the class which extends <emphasis role="strong">JFrame</emphasis>.  The constructor calls <emphasis role="strong">super</emphasis> to initiate a <emphasis role="strong">JFrame</emphasis> with the title &quot;UKLights&quot;. An <emphasis role="strong">ImageIcon</emphasis> is created containing the image <filename>uklights.jpeg</filename>. <filename>uklights.jpeg</filename> can be downloaded here: <ulink url="files/uklights/uklights.jpeg">uklights.jpeg</ulink>. 
    </para>
      
    <para>
      Readers of the print version of this tutorial should use some other <filename>jpeg</filename> or <filename>gif</filename> and make the necessary adjustments to the program source. After the <emphasis role="strong">ImageIcon</emphasis> is created it is added to the a new <emphasis role="strong">JLabel</emphasis> which is then added to the <emphasis role="strong">JFrame</emphasis>. The default close operation for the <emphasis role="strong">JFrame</emphasis> is set, the size set to that of the <emphasis role="strong">ImageIcon</emphasis>, and the frame made visible. The second method is the <emphasis>main</emphasis> method which is called when executing the program like this:
    </para>

    <screen><userinput><command>java</command> UKLights</userinput></screen>

    <para>
      The program displays the specified image in a <emphasis role="strong">JFrame</emphasis>. Change into the base directory that the directories <filename>src</filename>, <filename>build</filename>, and <filename>lib</filename> were created from. Create a file called <filename>build.xml</filename>.
    </para>

    <para>
      The first thing that the build file must contain is a standard <acronym>XML</acronym> declaration:
    </para>

    <programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;</programlisting>

    <para>
      This provides a way for any tools that may process the file to find out the version of <acronym>XML</acronym> in use. Next, add the standard Ant root <acronym>XML</acronym> element, <emphasis>project</emphasis>:
    </para>

    <programlisting>&lt;project name=&quot;UKLights&quot; default=&quot;all&quot; basedir=&quot;.&quot;&gt;
&lt;/project&gt;</programlisting>

    <para>
      The rest of the Ant buildfile is contained within this element. Three attributes have been specified for the project. The first is <emphasis>name</emphasis>; the name given to this project. The second is <emphasis>default</emphasis>; the default target to build, in this case <emphasis>all</emphasis>. The third is <emphasis>basedir</emphasis> which specifies the directory to use as the base directory, in this case, the current directory is used as indicated by '.'. The base directory is relative to the build file.
    </para>

    <para>
      The rest of the code snippets in this section shouold be placed inside the <emphasis>project</emphasis> element in the sequence in which they are introduced. Add these property definitions:
    </para>

    <programlisting>&lt;property name=&quot;src&quot;   value=&quot;src&quot;/&gt;
  &lt;property name=&quot;build&quot; value=&quot;build&quot;/&gt;
  &lt;property name=&quot;lib&quot;   value=&quot;lib&quot;/&gt;</programlisting>

    <para>
      These <emphasis>property</emphasis> definitions define properties of which the values can be accessed within the buildfile by enclosing the property name within braces and prefixing it with a dollar sign. To reference the property <emphasis>src</emphasis> use <emphasis role="strong">${src}</emphasis>. In this example, properties specifying the location of the source, build, and library directories described earlier have been created. This may seem unnecessary since, in this case, it takes longer to reference the property names than to type the actual values. However, referencing these directories via properties allows one to change the locations of these directories without having to change every reference to them. If Ant is ran on this buildfile the following error message is produced: 
    </para>

    <screen>
Buildfile: build.xml
BUILD FAILED
Target `all' does not exist in this project. 

Total time: 1 second
    </screen>

    <para>
      This specifies that the target <emphasis>all</emphasis> has not been defined yet, add it:
    </para>

    <programlisting>&lt;target name=&quot;all&quot; depends=&quot;UKLights&quot; 
           description=&quot;Builds the whole project&quot;&gt;
  &lt;echo&gt;Doing all&lt;/echo&gt;
&lt;/target&gt;</programlisting>

    <para>
      The <emphasis>all</emphasis> target <emphasis>depends</emphasis> on the target &quot;UKLights&quot;, meaning that &quot;UKLights&quot; will be called prior to executing the body of <emphasis>all</emphasis>. The description defined will be used by Ant's <option>projecthelp</option> option. Add the &quot;UKLights&quot; target that <emphasis>all</emphasis> depends on:
    </para>

    <programlisting>&lt;target name=&quot;UKLights&quot; 
               description=&quot;Builds the main UKLights project&quot;&gt;
  &lt;echo&gt;Doing UKLights&lt;/echo&gt;
&lt;/target&gt;</programlisting>

    <para>
      This target has a name and a description. The target descriptions are used by Ant's <option>projecthelp</option> option to display information about the available targets. If one executes the following command sequence: 
    </para>

    <screen><userinput><command>ant</command> <option>-projecthelp</option></userinput></screen>

    <para>The output produced is:</para>

    <screen>
Buildfile: build.xml
Main targets:

 UKLights  Builds the main UKLights project
 all       Builds the whole project

Default target: all
    </screen>

    <para>One executes the build file by typing <command>ant</command> in the base directory, the output produced is:</para>

    <screen>
Buildfile: build.xml

UKLights:
     [echo] Doing UKLights

all:
     [echo] Doing all

BUILD SUCCESSFUL
Total time: 1 second
    </screen>

    <para>
      Notice that &quot;UKLights&quot; was called before &quot;all&quot; because &quot;all&quot; depended on it.  Both targets have simple tasks, they both <emphasis>echo</emphasis> a message to the screen indicating that they have been called. The target should compile the Java file so add the line:
    </para>

    <programlisting>&lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot;/&gt;</programlisting>

    <para>
      Ant has built in support for the Java oriented commands <command>java</command> and <command>javac</command>.  The <emphasis>javac</emphasis> element compiles all the java files in the directory specified by the <emphasis>srcdir</emphasis> attribute and places them in the directory specified by the <emphasis>destdir</emphasis> attribute. Ant will only compile those source files with more recent timestamps than their corresponding output <filename>.class</filename> files. This behaviour is present in certain other Ant tasks, where it is not present, one must add the desired functionality manually. The output produced when Ant is ran on the modified build file is shown below:
    </para>

    <screen>
Buildfile: build.xml

UKLights:
     [echo] Doing UKLights
    [javac] Compiling 1 source file to \blah\blah\blah\build

all:
     [echo] Doing all

BUILD SUCCESSFUL
Total time: 2 seconds
    </screen>

    <para>
      There are various options that may be supplied to the <emphasis>javac</emphasis> task by setting their respective attributes in the task call. Options available include, <emphasis>listfiles</emphasis> - to list the files to be compiled, <emphasis>failonerror</emphasis> - to cause the build to fail if compilation errors are encountered, and <emphasis>verbose</emphasis> to specify that <command>java</command> be verbose. To set an attribute, set it's value to &quot;true&quot;. If <command>ant</command> is ran on the buildfile again without modifying anything it produces the output: 
    </para>

    <screen>
Buildfile: build.xml

UKLights:
     [echo] Doing UKLights

all:
     [echo] Doing all

BUILD SUCCESSFUL
Total time: 1 second
    </screen>

    <para>
      Which illustrates that no compilation was done this time round. Change into the <filename>build</filename> directory and execute <filename>UKLights.class</filename>. No picture is available because it was not copied into the build directory, add this line before the <emphasis>javac</emphasis> task:
    </para>

    <programlisting>&lt;copy file=&quot;${src}/UKLights.jpeg&quot; tofile=&quot;${build}/UKLights.jpeg&quot;/&gt;</programlisting>

    <para>Running ant on the modified build file produces identical output to last time with the addition of the line:</para>

    <screen>[copy] Copying 1 file to C:\docbook\docproj\src\items\ant\files\build</screen>

    <para>
      By default, Ant will only copy the file if it is more recent than the target file or the target file does not exist. To override this behaviour so that Ant always copies the file(s) specified, set the <emphasis>overwrite</emphasis> attribute to &quot;true&quot;.
    </para>

    <para>
      Another source file will be added to the program. Change the constructor of <filename>UKLights.java</filename> to:
    </para>

    <programlisting>public UKLights() {
   super(&quot;UKLights&quot;);
   ImageIcon icon = new ImageIcon(&quot;uklights.jpeg&quot;);

   JButton exitButton = new JButton(&quot;Exit&quot;);
   exitButton.addActionListener(new ExitControl());

   JButton aboutButton = new JButton(&quot;About&quot;);
   aboutButton.addActionListener(new AboutControl());

   getContentPane().setLayout(new FlowLayout());
   getContentPane().add(new JLabel(icon));
   getContentPane().add(aboutButton);
   getContentPane().add(exitButton);

   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   setSize(new Dimension(315,294));
   setVisible(true);
}</programlisting>

    <para>
      An <emphasis>exit</emphasis> button has been added and an <emphasis>about</emphasis> button, the layout has been set to <emphasis role="strong">FlowLayout</emphasis>, and the size of the <emphasis role="strong">JFrame</emphasis>increased to accommodate the buttons. The <emphasis role="strong">ExitControl</emphasis> to handle events from <emphasis role="strong">exitButton</emphasis>:
    </para>

    <programlisting>import java.awt.event.*;
public class ExitControl implements ActionListener {
   public void actionPerformed(ActionEvent e) {
      System.exit(0);
   }
}</programlisting>

    <para>
      Save this in a file called <filename>ExitControl.java</filename>, or download it here: <ulink url="files/uklights/ExitControl.java">ExitControl.java</ulink>. Put the file in the <filename>src</filename> directory. <emphasis role="strong">ExitControl</emphasis> causes the program to terminate when the user clicks on the exit button. An about button is created to display information about the picture loaded, events from this button are handled by <emphasis role="strong">AboutControl</emphasis>:
    </para>

    <programlisting>import java.awt.event.*;
public class AboutControl implements ActionListener {
   public void actionPerformed(ActionEvent e) {
      new AboutPopup();
   }
}</programlisting>

    <para>
      Save this in a file called <filename>AboutControl.java</filename>, or download it here: <ulink url="files/uklights/AboutControl.java">AboutControl.java</ulink>. Put the file in the <filename>src</filename> directory. <filename>AboutControl.java</filename> creates a new <emphasis role="strong">AboutPopup</emphasis>:
    </para>

    <programlisting>import javax.swing.*;
import java.awt.*;
public class AboutPopup extends JFrame {
   public AboutPopup() {
      super(&quot;About&quot;);
      String message = &quot;\n&quot;;
      message+=&quot;This image of Earth's city lights was created with data &quot;;
      message+=&quot;from the Defense Meteorological Satellite Program &quot;;
      message+=&quot;(DMSP) Operational Linescan System (OLS). &quot;;
      message+=&quot;Originally designed to view clouds by moonlight, &quot;;
      message+=&quot;the OLS is also used to map the locations of permanent &quot;;
      message+=&quot;lights on the Earth's surface.\n\n&quot;;
      message+=&quot;The image has been modified by Ashley Mills to only include &quot;;
      message+=&quot;the UK, the original image and further description can be &quot;;
      message+=&quot;found at:\n\n&quot;;
      message+=&quot;http://visibleearth.nasa.gov/cgi-bin/viewrecord?5826\n\n&quot;;
      message+=&quot;This is also where the description was taken from.&quot;;
      setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      setSize(new Dimension(315,294));
      JTextPane messagePane = new JTextPane();
      messagePane.setBackground(Color.BLACK);
      messagePane.setForeground(Color.GRAY);
      messagePane.setEditable(false);
      messagePane.setText(message);
      getContentPane().add(messagePane);
      setResizable(false);
      setVisible(true);
   }
}</programlisting>

    <para>
      Save this in a file called <filename>AboutPopup.java</filename> or download it here: <ulink url="files/uklights/AboutPopup.java">AboutPopup.java</ulink>. Put the file in the <filename>src</filename> directory. <filename>AboutPopup.java</filename> extends <emphasis role="strong">JFrame</emphasis> hence when instantiated will create a new frame so <emphasis role="strong">super</emphasis> is called with the string that will be the title of the <emphasis role="strong">JFrame</emphasis>. A message is defined. The default close operation for the <emphasis role="strong">JFrame</emphasis> is set. The size of the <emphasis role="strong">JFrame</emphasis>is set. A <emphasis role="strong">JTextPane</emphasis> is created, it's colours are setup and it's is made non-editable. It's message is set. It is added to the <emphasis role="strong">JFrame</emphasis>. The <emphasis role="strong">JFrame</emphasis> is made non-resizable and made visible.
    </para>

    <para>Modify the &quot;UKLights&quot; target in <filename>build.xml</filename>:</para>

    <programlisting>&lt;target name=&quot;UKLights&quot; depends=&quot;AboutControl,ExitControl&quot;
          description=&quot;Builds the main UKLights project&quot;&gt;
  &lt;echo&gt;Doing UKLights&lt;/echo&gt;
  &lt;copy file=&quot;${src}/UKLights.jpeg&quot; tofile=&quot;${build}/UKLights.jpeg&quot;/&gt;
  &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot; includes=&quot;UKLights.java&quot;/&gt;
&lt;/target&gt;</programlisting>

    <para>
      The &quot;UKLights&quot; target now depends on the &quot;AboutControl&quot; and &quot;ExitControl&quot; targets. The javac line has been modified so that only <filename>UKLights.java</filename> is compiled by this target, the <emphasis>includes</emphasis> attribute, which can accept a list of files, is used to acheive this. Usually one would just use a single javac task to compile all the classes by ommiting the includes attribute. Add the <emphasis>AboutControl</emphasis> target:
    </para>

    <programlisting>&lt;target name=&quot;AboutControl&quot; depends=&quot;AboutPopup&quot;
          description=&quot;Builds AboutControl&quot;&gt;
  &lt;echo&gt;Doing AboutControl&lt;/echo&gt;
  &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot; includes=&quot;AboutControl.java&quot;/&gt;
&lt;/target&gt;</programlisting>

    <para>
      This compiles <filename>AboutControl.java</filename> and depends on the &quot;AboutPopup&quot; target. Add the &quot;AboutPopup&quot; target:
    </para>

    <programlisting>&lt;target name=&quot;AboutPopup&quot; description=&quot;Builds AboutPopup&quot;&gt;
  &lt;echo&gt;Doing AboutPopup&lt;/echo&gt;
  &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot; includes=&quot;AboutPopup.java&quot;/&gt;
&lt;/target&gt;</programlisting>

    <para>
      This compiles <filename>AboutPopup.java</filename>. Add the &quot;ExitControl&quot; target:
    </para>

    <programlisting>&lt;target name=&quot;ExitControl&quot; description=&quot;Builds ExitControl&quot;&gt;
  &lt;echo&gt;Doing ExitControl&lt;/echo&gt;
  &lt;javac srcdir=&quot;${src}&quot; destdir=&quot;${build}&quot; includes=&quot;ExitControl.java&quot;/&gt;
&lt;/target&gt;</programlisting>

    <para>
      This compiles <filename>ExitControl.java</filename>. One more target, &quot;Clean&quot;, will be added. &quot;Clean&quot;'s purpose is to delete the contents of the build directory.
    </para>

    <programlisting>&lt;target name=&quot;Clean&quot; description=&quot;Removes previous build&quot;&gt;
  &lt;delete verbose=&quot;true&quot;&gt;
    &lt;fileset dir=&quot;${build}&quot;/&gt;
  &lt;/delete&gt;
&lt;/target&gt;</programlisting>

    <para>
      This deletes the contents of the build directory, this is achieved by specifying a <emphasis>fileset</emphasis> with the <emphasis>dir</emphasis> attribute set to the directory to delete the contents of. To delete the directory as well as the contents of the directory, set the<emphasis>includeEmptyDirs</emphasis> attribute to &quot;true&quot;. The <emphasis>verbose</emphasis> attribute on <emphasis>delete</emphasis> is set to &quot;true&quot; so that Ant will list each file being deleted.
    </para>

    <para>
      The completed <filename>build.xml</filename> can be downloaded here: <ulink url="files/uklights/build.xml">build.xml</ulink>. The completed <filename>UKLights.java</filename> can be downloaded here: <ulink url="files/uklights/UKLights.java">UKLights.java</ulink>.
    </para>

    <para>The project is complete; testing can commence. Execute the &quot;Clean&quot; target to remove the old build:</para>

    <screen><userinput><command>ant</command> Clean</userinput></screen>

    <para>This produces output similar to:</para>

    <screen>
Buildfile: build.xml

Clean:
   [delete] Deleting 2 files from \blah\blah\build
   [delete] Deleting \blah\blah\blah\build\UKLights.class
   [delete] Deleting \blah\blah\blah\build\uklights.jpeg

BUILD SUCCESSFUL
Total time: 1 second
    </screen>

    <para>
      Run Ant with no arguments so it executes the default target, &quot;all&quot;, by typing <command>ant</command> at the command line in the base directory, the output produced is:
    </para>

    <screen>
Buildfile: build.xml

AboutPopup:
     [echo] Doing AboutPopup
    [javac] Compiling 1 source file to \blah\blah\blah\build

AboutControl:
     [echo] Doing AboutControl
    [javac] Compiling 1 source file to \blah\blah\blah\build

ExitControl:
     [echo] Doing ExitControl
    [javac] Compiling 1 source file to \blah\blah\blah\build

UKLights:
     [echo] Doing UKLights
     [copy] Copying 1 file to  \blah\blah\blah\build
    [javac] Compiling 1 source file to \blah\blah\blah\build

all:
     [echo] Doing all

BUILD SUCCESSFUL
Total time: 4 seconds
    </screen>

    <para>
      Notice the order that the targets are executed, first &quot;AboutPopup&quot;, then &quot;AboutControl&quot;, then &quot;ExitControl&quot; then &quot;UKLights&quot;, then finally, &quot;all&quot;. This is because the dependencies of a target are exectuted before the target itself. The build was successful as indicated by &quot;BUILD SUCCESSFUL&quot;, <filename>UKLights.class</filename> was created, execute <filename>UKLights.class</filename> and enjoy the image. The reader should now be able to use Ant in a simple project.
    </para>
  </sect1>

  <sect1 id="Ant-Filesets"><title>A Bit About FileSets</title>
    <para>
      A <emphasis>FileSet</emphasis> is a filter which uses one or more patterns to specify which files are desired. A <emphasis>FileList</emphasis> is a list of desired files. <emphasis>FileSet</emphasis>s use <emphasis>PatternSet</emphasis>s and <emphasis>Pattern</emphasis>s to define their actions.
    </para>

    <itemizedlist>
      <listitem>
        <para>
          <emphasis role="strong">?</emphasis> is used to match any character. 
        </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="strong">*</emphasis> is used to match zero or more characters.
        </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="strong">**</emphasis> is used to match zero or more directories.
        </para>
      </listitem>
    </itemizedlist>

    <para>
      A <emphasis>FileSet</emphasis> must specify a base directory from which all other path calculations are made, this is supplied via the <emphasis>dir</emphasis> attribute. A <emphasis>FileSet</emphasis> has the basic form:
    </para>

    <programlisting>&lt;fileset dir=&quot;BASEDIR&quot;/&gt;</programlisting>

    <para>Or:</para>

    <programlisting>&lt;fileset dir=&quot;BASEDIR&quot;&gt;
&lt;/fileset&gt;</programlisting>

    <para>
      Since both of these <emphasis>FileSet</emphasis>s contain no patterns, they match the default; every file in the base directory and all it's subdirectories, recursively, apart from the files which match the following patterns:
    </para>

    <programlisting>**/*~
**/#*#
**/.#*
**/%*%
**/._*
**/CVS
**/CVS/**
**/.cvsignore
**/SCCS
**/SCCS/**
**/vssver.scc
**/.svn
**/.svn/**</programlisting>

    <para>
      Notice that the sequence &quot;**&quot; is used above to denote zero or more directories, for example, the first pattern matches any file in the base directory or any of it's directories that end with the '~' character, which some common tools use to denote scratch or backup files. The other patterns are excluded for similar reasons.
    </para>

    <note>
      <para>If one desires to delete any of these defaultly excluded files, for example, to delete all scratch files that vim (a text editor) made, recursively, one has to set <emphasis>defaultexcludes=&quot;no&quot;</emphasis> so that the defaults are not excluded and then one could use something like:</para>

      <programlisting>
      &lt;?xml version=&quot;1.0&quot;?&gt;
      &lt;project name=&quot;Scratch Cleaner&quot; default=&quot;clean&quot; basedir=&quot;.&quot;&gt;
        &lt;target name=&quot;clean&quot;&gt;
          &lt;echo&gt;Removing temporary files...&lt;/echo&gt;
          &lt;delete verbose=&quot;true&quot;&gt; &lt;!-- Remove all *~ files --&gt;
            &lt;fileset dir=&quot;${basedir}&quot; defaultexcludes=&quot;no&quot;&gt;
              &lt;include name=&quot;**/*~&quot;/&gt;
            &lt;/fileset&gt;
          &lt;/delete&gt;
        &lt;/target&gt; 
      &lt;/project&gt;
      </programlisting>

      <para/>
    </note>

    <programlisting>&lt;fileset dir=&quot;.&quot; includes=&quot;**/*.blah **/*.bleh&quot;</programlisting>

    <para>
      Includes all files ending in the extensions &quot;blah&quot; and &quot;bleh&quot; in the base directory and all subdirectories, the pattern is applied recursively in the subdirectories.
    </para>

    <programlisting>&lt;fileset dir=&quot;.&quot;&gt;
  &lt;include name=&quot;**/*bl*&quot;/&gt;
  &lt;exclude name=&quot;**/blah/*&quot;/&gt;
&lt;/fileset&gt;</programlisting>

    <para>
      Includes all files that contain the string &quot;bl&quot; in the base directory and all sub directories, recursively. Excludes any files in any directory called &quot;blah&quot;, whether it occurs in the current directory or any of the sub directories, recursively. Notice that the syntax is slightly different, in that, <emphasis>include</emphasis> and <emphasis>name</emphasis> are used instead of <emphasis>includes</emphasis> and <emphasis>exclude</emphasis> and <emphasis>name</emphasis> are used instead of <emphasis>excludes</emphasis>.
    </para>

    <note>
      <para>
        In the context of the sentences above, the word &quot;recursively&quot; means that the pattern is applied to each of the sub-directories as well as the base directory hence it is then applied to the sub-directories of the sub-directories and so on. The pattern is applied to all directories under the base directory.
      </para>
    </note>

    <para>
      Patterns can be 'saved' for future use by encapsulating them within a <emphasis>patternset</emphasis> element:
    </para>

    <programlisting>&lt;fileset dir=&quot;.&quot;&gt;
  &lt;patternset id=&quot;blah&quot;&gt;
    &lt;include name=&quot;**/*bl*&quot;/&gt;
    &lt;exclude name=&quot;**/blah/*&quot;/&gt;
  &lt;/patternset&gt;
&lt;/fileset&gt;</programlisting>

    <para>This pattern could be referenced by any other element that supports this kind of referencing:</para>

    <programlisting>&lt;fileset dir=&quot;&gt;
  &lt;patterset refid=&quot;blah&quot;/&gt;
&lt;/fileset&gt;</programlisting>

    <para>
      One can also use the <emphasis>if</emphasis> and <emphasis>unless</emphasis> attributes with <emphasis>include</emphasis> and <emphasis>exclude</emphasis> to provide conditional inclusions or exclusions:
    </para>

    <programlisting>&lt;fileset dir=&quot;.&quot;&gt;
  &lt;include name=&quot;**/extensions/*.java&quot; if=&quot;version.professional&quot;/&gt;
&lt;/fileset&gt;</programlisting>

    <para>
      Which includes all the java files within any sub-directories called &quot;extensions&quot;, from the base directory, only if some property called &quot;version.professional&quot; is set.
    </para>

    <programlisting>&lt;fileset dir=&quot;.&quot;&gt;
  &lt;exclude name=&quot;chinese.lang&quot; unless=&quot;language.chinese&quot;/&gt;
&lt;/fileset&gt;</programlisting>

    <para>
      Which excludes the chinese language module unless the property &quot;language.chinese&quot; is set. If one finds that a lot of <emphasis>include</emphasis> or <emphasis>exclude</emphasis> elements are being used, it can be useful to define the <emphasis>include</emphasis> and <emphasis>exclude</emphasis> elements in an external file. The external file can then be referenced from within a build file with <emphasis>includesfile</emphasis> <emphasis>or</emphasis> <emphasis>excludesfile</emphasis> respectively. The referenced file is treated as having one <emphasis>include</emphasis> or <emphasis>exclude</emphasis> element per line:
    </para>

    <programlisting>&lt;fileset dir=&quot;.&quot;&gt;
  &lt;includesfile name=&quot;some.file&quot;/&gt;
&lt;/fileset&gt;</programlisting>

    <para><filename>some.file</filename> would look like:</para>

    <programlisting>bl?h.bl?h
*.java</programlisting>

    <para>
      Notice, that each line contains the value that would be assigned to each of the <emphasis>include</emphasis> statements' <emphasis>name</emphasis> attribute. Similarly, an <emphasis>exludesfile could be specified:</emphasis>
    </para>

    <programlisting>&lt;fileset dir=&quot;.&quot;&gt;
  &lt;excludesfile name=&quot;some.file&quot;/&gt;
&lt;/fileset&gt;</programlisting>

    <para><filename>some.file</filename> would look like:</para>

    <programlisting>Test.java
**/extensions/*
build.xml
cool.file</programlisting>

    <para>
      <emphasis>if</emphasis> and <emphasis>unless</emphasis> can be used with <emphasis>includesfile</emphasis> and <emphasis>excludesfile</emphasis>. <emphasis>FileList</emphasis>s specify a list of files and do not support wildcards. The <emphasis>dir</emphasis> attribute specifies the base directory. The <emphasis>files</emphasis> attribute specifies a comma or space separated list of files and the <emphasis>id</emphasis> attribute is optional:
    </para>

    <programlisting>&lt;filelist id=&quot;blah&quot; dir=&quot;.&quot;
files=&quot;blah.blah bleh.bleh&quot;/&gt;</programlisting>

    <para>
      <emphasis>id</emphasis>s may be referenced from another filelists:
    </para>

    <programlisting>&lt;filelist refid=&quot;blah&quot;/&gt;</programlisting>

    <para>
      I know of no way arbitrarily exclude or include a filelist, for this behaviour use a <emphasis>fileset</emphasis>, <emphasis>patternset</emphasis> or <emphasis>dirset</emphasis>.
    </para>
  </sect1>

  <sect1 id="Ant-Advanced-Topics"><title>Advanced Topics</title>
     <sect2 id="Ant-Advanced-Topics-Flow-Of-Control"><title>Flow Of Control</title>
       <para>
         Since Ant does not contain any real control structures like <emphasis>if..then..else</emphasis>, one has to manipulate Ant's ability to call internal targets that support conditional execution to emulate the desired control structures.  Consider the control sequence:
       </para>
   
       <programlisting>if( condition ) {
   if( inner-condition ) {
      A
   } else {
      B
   }
} else {
   C
}</programlisting>
   
       <para>
         There are three possible routes that the program could take, designated by the actions <emphasis role="strong">A</emphasis>, <emphasis role="strong">B</emphasis> and <emphasis role="strong">C</emphasis>. This can be expressed in Ant as:
       </para>
   
       <programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;project name=&quot;Flow.Of.Control&quot; default=&quot;nested-if&quot; basedir=&quot;.&quot;&gt;

  &lt;target name=&quot;nested-if&quot;&gt;
    &lt;condition property=&quot;condition&quot;&gt;
      &lt;available file=&quot;fileone&quot;/&gt;
    &lt;/condition&gt;
    &lt;antcall target=&quot;then&quot;/&gt;
    &lt;antcall target=&quot;else&quot;/&gt;
  &lt;/target&gt;

  &lt;target name=&quot;then&quot; if=&quot;condition&quot;&gt;
    &lt;echo&gt;THEN BODY EXECUTED&lt;/echo&gt;
    &lt;condition property=&quot;inner-condition&quot;&gt;
      &lt;available file=&quot;filetwo&quot;/&gt;
    &lt;/condition&gt;
    &lt;antcall target=&quot;inner.then&quot;/&gt;
    &lt;antcall target=&quot;inner.else&quot;/&gt;
  &lt;/target&gt;

     &lt;target name=&quot;inner.then&quot; if=&quot;inner-condition&quot;&gt;
       &lt;echo&gt;INNER THEN BODY EXECUTED&lt;/echo&gt;
     &lt;/target&gt;

     &lt;target name=&quot;inner.else&quot; unless=&quot;inner-condition&quot;&gt;
       &lt;echo&gt;INNER ELSE BODY EXECUTED&lt;/echo&gt;
     &lt;/target&gt;

  &lt;target name=&quot;else&quot; unless=&quot;condition&quot;&gt;
    &lt;echo&gt;ELSE BODY EXECUTED&lt;/echo&gt;
  &lt;/target&gt;
&lt;/project&gt;</programlisting>
   
       <para>
         It can be downloaded here: <ulink url="files/build.xml">build.xml</ulink>. A diagram which attempts to clarify the location of the various components of the control structure is shown below:
       </para>
   
       <figure><title>Nested If..Then..Else In Ant</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/controlflow.png" format="PNG"/></imageobject>
         </mediaobject>
       </figure>
   
       <para>
         Assuming the case where the first file, <filename>fileone</filename>, and the second file, <filename>filetwo</filename> are not available. The initial condition checks if the file <filename>fileone</filename> available, if it is, the property <emphasis>condition</emphasis> is set. Calls to the targets <emphasis role="strong">then</emphasis> and <emphasis role="strong">else</emphasis> follow. The execution of <emphasis role="strong">then</emphasis> is conditional, dictated by (if=&quot;<emphasis>condition</emphasis>&quot;). Since the assumption is <filename>fileone</filename> is not available, <emphasis>condition</emphasis> will not be set and the body of <emphasis role="strong">then</emphasis> will not be executed. The next target, <emphasis role="strong">else</emphasis>, will be called. The execution of <emphasis role="strong">else</emphasis> is conditional, dictated by (unless=&quot;<emphasis>condition</emphasis>&quot;) which means that the body will be executed <emphasis>unless</emphasis><emphasis>condition</emphasis> is set. Since <emphasis>condition</emphasis> has not been set, the body of <emphasis role="strong">else</emphasis> will be executed. The output from simulating this by running <command>ant</command> on the build file with the files <filename>fileone</filename> and <filename>filetwo</filename> not available is shown below: 
       </para>
   
       <figure><title>Output produced when ant is ran when <filename>fileone</filename> and <filename>filetwo</filename> are not available</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/outputnofiles.png" format="PNG"/></imageobject>
         </mediaobject>
       </figure>
   
       <para>
         Assuming the case where the first file, <filename>fileone</filename>, is present, and the second file, <filename>filetwo</filename> is not. The initial condition will be set because <filename>fileone</filename> is available so the call to <emphasis role="strong">then</emphasis> will be successful. The body of <emphasis role="strong">then</emphasis> contains another condition which checks for the existence of the file <filename>filetwo</filename>, if it is available, the property, <emphasis>inner-condition</emphasis> is set. Since the assumption is that <filename>filetwo</filename> is not available, the property <emphasis>inner-condition</emphasis> will not be set. Calls to the targets <emphasis role="strong">inner.then</emphasis> and <emphasis role="strong">inner.else</emphasis> follow. The execution of <emphasis role="strong">inner.then</emphasis> is conditional, dictated by (if=&quot;<emphasis>inner-condition</emphasis>&quot;) so the body of <emphasis role="strong">inner.then</emphasis> will not be executed. The execution of <emphasis role="strong">inner.else</emphasis> is conditional, dictated by (unless=&quot;<emphasis>inner-condition</emphasis>&quot;) so the body of <emphasis role="strong">inner.else</emphasis> will be executed since the only thing that would stop the execution of it would be if <emphasis>inner-condition</emphasis> was set. The output from simulating this by running <command>ant</command> on the build file with the file <filename>fileone</filename> available and the file <filename>filetwo</filename> not available is shown below: 
       </para>
   
       <figure><title>Output produced when ant is ran with <filename>fileone</filename> available and <filename>filetwo</filename> not available</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/outputonlyfileone.png" format="PNG"/></imageobject>
         </mediaobject>
       </figure>
   
       <para>
         Upon exiting the call to <emphasis role="strong">then</emphasis>, the target <emphasis role="strong">else</emphasis> will be called but the body will not be executed because the condition (unless=&quot;condition&quot;), specifies that if <emphasis>condition</emphasis> is set, the target should not be executed.
       </para>
   
       <para>
         Assuming the case where the first file, <filename>fileone</filename>, and the second file, <filename>filetwo</filename> are both available. The outer condition will cause the property <emphasis>condition</emphasis> to be set because <filename>fileone</filename> is available, so when the target <emphasis role="strong">then</emphasis> is called, the body will be executed. The condition within <emphasis role="strong">then</emphasis> will cause the property <emphasis>inner-condition</emphasis> to be set because <filename>filetwo</filename> is available. This means that the call to <emphasis role="strong">inner.then</emphasis> will be successful. Upon exiting <emphasis role="strong">inner.then</emphasis>, <emphasis role="strong">inner.else</emphasis> will be called but the body will not be executed because <emphasis>inner-condition</emphasis> is set. Upon exiting <emphasis role="strong">then</emphasis>, <emphasis role="strong">else</emphasis> will be called but the body will not be executed because <emphasis>condition</emphasis> is set. The output from simulating this by running <command>ant</command> on the build file with the files, <filename>fileone</filename> and <filename>filetwo</filename>, available is shown below:
       </para>
   
       <figure><title>Output produced when ant is ran with <filename>fileone</filename> and <filename>filetwo</filename> both available</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/outputbothfiles.png" format="PNG"/></imageobject>
         </mediaobject>
       </figure>
     </sect2>
  </sect1>

  <sect1 id="Ant-References"><title>References</title>
    <itemizedlist>
      <listitem>
        <para><ulink url="http://jakarta.apache.org/ant/resources.html">http://jakarta.apache.org/ant/resources.html</ulink></para>

        <para>Apache Ant Resource Homepage</para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://jakarta.apache.org/ant/manual/index.html">
            http://jakarta.apache.org/ant/manual/index.html
          </ulink>
        </para>
        <para>Apache Ant 1.5 Manual</para>
      </listitem>

      <listitem>
        <para><ulink url="http://www.iseran.com/Java/ant/tutorial/ant_tutorial.html">http://www.iseran.com/Java/ant/tutorial/ant_tutorial.html</ulink></para>

        <para>A beginners guide to Ant Steve Loughran 2001-04-30</para>
      </listitem>
    </itemizedlist>
  </sect1>
</article>

