build.xml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <project name="SimpleApp" default="exe" basedir=".">
  2. <property name="src" location="src" />
  3. <property name="lib" location="lib" />
  4. <property name="build" location="build" />
  5. <property name="launch4j.dir" location="../.." />
  6. <path id="dist.classpath">
  7. <pathelement path="${build}" />
  8. <fileset dir="${lib}">
  9. <include name="**/*.jar" />
  10. </fileset>
  11. </path>
  12. <target name="init">
  13. <tstamp />
  14. <mkdir dir="${build}" />
  15. </target>
  16. <target name="compile" depends="init" description="compile the source">
  17. <javac srcdir="${src}" destdir="${build}" classpathref="dist.classpath" source="1.8" debug="on" includeantruntime="false" />
  18. </target>
  19. <target name="jar" depends="compile" description="create the jar">
  20. <fileset dir="${lib}" id="lib.dist.fileset">
  21. <include name="**/*.jar" />
  22. </fileset>
  23. <pathconvert pathsep=" " property="dist.classpath" refid="lib.dist.fileset">
  24. <map from="${lib}" to=".\lib" />
  25. </pathconvert>
  26. <!-- Put everything in ${build} into a jar file -->
  27. <jar jarfile="${ant.project.name}.jar">
  28. <fileset dir="${build}" includes="**/*" />
  29. <manifest>
  30. <!-- SET YOUR MAIN CLASS HERE -->
  31. <attribute name="Main-Class" value="net.sf.launch4j.example.SimpleApp" />
  32. <attribute name="Class-Path" value=". ${dist.classpath}" />
  33. </manifest>
  34. </jar>
  35. </target>
  36. <target name="exe" depends="jar">
  37. <taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar
  38. :${launch4j.dir}/lib/xstream.jar" />
  39. <launch4j configFile="./l4j/SimpleApp.xml" />
  40. </target>
  41. <target name="clean" description="clean up">
  42. <delete dir="${build}" />
  43. <delete file="${ant.project.name}.jar" />
  44. <delete file="${ant.project.name}.exe" />
  45. </target>
  46. </project>