build.xml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?xml version="1.0" ?>
  2. <project name="ProjectName" default="jarfile">
  3. <!-- Initialize build properties -->
  4. <target name="init" description="Initializes properties">
  5. <property name="project.name" value="ProjectName" />
  6. <property name="src.dir" value="src" />
  7. <property name="main.class" value="org.academiadecodigo.bootcamp11.project.Main" />
  8. <property name="build.dir" value="build" />
  9. <property name="classes.dir" value="${build.dir}/classes" />
  10. <property name="lib.dir" value="lib" />
  11. </target>
  12. <!-- Creates the build directories to hold JAR and Janela files -->
  13. <target name="prepare" description="Creates the build and classes directories" depends="init">
  14. <mkdir dir="${classes.dir}" />
  15. </target>
  16. <!-- Removes the build directory -->
  17. <target name="clean" description="Clean up project" depends="init">
  18. <delete dir="${build.dir}" />
  19. </target>
  20. <!-- Compiles the source code -->
  21. <target name="compile" description="Compiles the source code" depends="prepare">
  22. <javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}"/>
  23. </target>
  24. <!-- Creates a JAR file -->
  25. <target name="jarfile" description="Archives the code" depends="compile">
  26. <jar destfile="${build.dir}/${project.name}.jar" basedir="${classes.dir}">
  27. <manifest>
  28. <attribute name="Main-Class" value="${main.class}" />
  29. </manifest>
  30. </jar>
  31. </target>
  32. </project>