build.xml 1.5 KB

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