Reference ant.project.name
<?xml version="1.0" encoding="UTF-8"?> <project basedir="." default="build" name="Agnotion"> <property name="JUNIT_HOME" value="eclipse/plugins/org.junit_3.8.1"/> <path id="project.classpath"> <pathelement location="build/java"/> <pathelement location="build/test"/> <pathelement location="${JUNIT_HOME}/junit.jar"/> </path> <target name="init"> <mkdir dir="build/test"/> <mkdir dir="build/java"/> <mkdir dir="dist"/> </target> <target name="clean"> <delete dir="build/test"/> <delete dir="build/java"/> <delete dir="dist"/> </target> <target depends="init" name="build"> <javac destdir="build/java"> <src path="src/java"/> <classpath refid="project.classpath"/> </javac> <javac destdir="build/test"> <src path="src/test"/> <classpath refid="project.classpath"/> </javac> </target> <target name="dist" depends="build"> <jar destfile="dist/${ant.project.name}.jar" basedir="build/java" /> </target> </project>