$ ant dist
<project name="example" default="compile" basedir=".">
<property name="app.name" value="example"/>
<property name="app.version" value="1.0"/>
<property name="build.home" value="${basedir}/target" />
<target name="clean" description="Delete old build directory">
<delete dir="${build.home}" />
</target>
<target name="dist" depends="compile">
<jar destfile="${build.home}/${app.name}${app.version}.jar">
<fileset dir="${build.home}/classes"><include name="**/*.*" /></fileset>
</jar>
</target>
<target name="compile" description="Compile project">
<mkdir dir="${build.home}/classes/" />
<javac srcdir="${basedir}/src/java" destdir="${build.home}/classes">
<classpath>
<pathelement location="${basedir}/lib/log4j-1.2.8.jar" />
</classpath>
</javac>
</target>
</project>