<? xml version="1.0" ?> < project name ="javaTest" default ="jar" basedir ="." > < target name ="clean" > < delete dir ="build" /> </ target > < path id ="classpath" > < fileset dir ="lib" > < include name ="*.jar" /> </ fileset > </ path > < target name ="compile" depends ="clean" > < mkdir dir ="build/classes" /> < javac srcdir ="src" destdir ="build/classes" encoding ="UTF-8" > < classpath refid ="classpath" /> </ javac > </ target > < target name ="run" depends ="compile" > < java classname ="Main" > < classpath > <!-- <classpath refid="classpath"/> --> < pathelement path ="build/classes" /> </ classpath > </ java > </ target > < target name ="copyConfig" depends ="run" > < copy todir ="build/classes" > < fileset dir ="src" > < include name ="*.png" /> </ fileset > </ copy > </ target > < target name ="jar" depends ="copyConfig" > < pathconvert property ="mf.classpath" pathsep =" " > < mapper > < chainedmapper > < flattenmapper /> < globmapper from ="*" to ="lib/*" /> </ chainedmapper > </ mapper > < path refid ="classpath" /> </ pathconvert > < jar destfile ="main.jar" basedir ="build/classes" > < manifest > < attribute name ="Main-class" value ="Main" /> < attribute name ="Class-Path" value ="${mf.classpath} " /> </ manifest > </ jar > </ target > </ project >