ANT (Another Neat Tool)

ANT is a tool for automating software build processes, implemented in Java, and best suited to build Java projects. Ant uses an XML file to describe the build process and its dependencies.

Ant is an Apache project, it is open source software, released under the Apache Software License

Project Template

Here follows a simple buildfile that:

  • initializes properties and classpath
  • compile java classes
  • build jar and javadoc
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="build" >
    <description>simple project buildfile</description>

    <target name="init" 
    		description="initialize properties and classpath">
        <property name="dir.sources" value="src"/>
        <property name="dir.lib" value="lib"/>
        <property name="" value="build"/>
        <property name="" value="${}/classes"/>
        <path id="classpath.project">
	        <fileset dir="${dir.lib}"></fileset>

    <target name="build" depends="compile" 
    		description="builds the project">
        <jar jarfile="${}/jar/${}.jar">
        	<fileset dir="${}" includes="**" />
    	<javadoc destdir="${}/doc">
    		<fileset dir="${dir.sources}" defaultexcludes="yes" includes="**/*.java"/>

    <target name="compile" depends="init" 
    		description="compile java classes">
    	<javac srcdir="${dir.sources}" destdir="${}">
    		<classpath refid="classpath.project"/>