1 <project name="SimpleSample" basedir="." default="rebuild-run"> 2 3 <property name="src.dir" value="src"/> 4 5 <property name="lib.dir" value="${ocvJarDir}"/> 6 <path id="classpath"> 7 <fileset dir="${lib.dir}" includes="**/*.jar"/> 8 </path> 9 10 <property name="build.dir" value="build"/> 11 <property name="classes.dir" value="${build.dir}/classes"/> 12 <property name="jar.dir" value="${build.dir}/jar"/> 13 14 <property name="main-class" value="${ant.project.name}"/> 15 16 17 <target name="clean"> 18 <delete dir="${build.dir}"/> 19 </target> 20 21 <target name="compile"> 22 <mkdir dir="${classes.dir}"/> 23 <javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/> 24 </target> 25 26 <target name="jar" depends="compile"> 27 <mkdir dir="${jar.dir}"/> 28 <jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}"> 29 <manifest> 30 <attribute name="Main-Class" value="${main-class}"/> 31 </manifest> 32 </jar> 33 </target> 34 35 <target name="run" depends="jar"> 36 <java fork="true" classname="${main-class}"> 37 <sysproperty key="java.library.path" path="${ocvLibDir}"/> 38 <classpath> 39 <path refid="classpath"/> 40 <path location="${jar.dir}/${ant.project.name}.jar"/> 41 </classpath> 42 </java> 43 </target> 44 45 <target name="rebuild" depends="clean,jar"/> 46 47 <target name="rebuild-run" depends="clean,run"/> 48 49 </project>