Tired of carrying a stick around or rewriting it every time.
Here we’ll always find it
build.xml
<project basedir="." default="build-src" name="name" > <!-- Global Properties --> <property name="dir.src" location="./src" /> <property name="dir.src.java" location="./src/java" /> <property name="dir.src.test" location="./src/test" /> <property name="dir.lib" location="./lib" /> <property name="dir.target" location="./target" /> <property name="dir.resources" location="./resources" /> <property name="dir.resources" location="./resources" /> <property name="dir.release" location="./rel" /> <property name="dir.doc" location="./doc" /> <!-- Jar-Names --> <property name="jar.version" value="0.0.1" /> <property name="jar.name.bin" value="${ant.project.name}-bin-${jar.version}.jar" /> <property name="jar.manifest" value="./MANIFEST.MF" /> <!-- ClassPath References --> <path id="cp"> <fileset dir="${dir.lib}" includes="*.*" /> <fileset dir="${dir.resources}" includes="*.*" /> </path> <!-- Targets --> <!-- Builds --> <target name="build-src"> <mkdir dir="${dir.target}"/> <javac srcdir="${dir.src.java}" destdir="${dir.target}" classpathref="cp"></javac> </target> <target name="build-test"> <mkdir dir="${dir.target}"/> <javac srcdir="${dir.src}" destdir="${dir.target}" classpathref="cp"> </javac> </target> <!-- Jars --> <target name="jar-bin" depends="cleanTarget, build-src"> <jar destfile="${dir.release}/${jar.name.bin}" basedir="${dir.target}" manifest="${jar.manifest}" /> </target> <!-- Cleans --> <target name="clean"> <antcall target="cleanDoc" /> <antcall target="cleanRelease" /> <antcall target="cleanTarget" /> </target> <target name="cleanRelease"> <mkdir dir="${dir.release}"/> <delete dir="${dir.release}" includeemptydirs="true" includes="**/*" /> </target> <target name="cleanTarget"> <mkdir dir="${dir.target}"/> <delete dir="${dir.target}" includeemptydirs="true" includes="**/*" /> </target> <target name="cleanDoc"> <mkdir dir="${dir.doc}"/> <delete dir="${dir.doc}" includeemptydirs="true" includes="**/*" /> </target> <!-- Doc --> <target name="doc"> <mkdir dir="${dir.doc}"/> <javadoc access="protected" author="true" classpathref="cp" destdir="${dir.doc}" sourcepath="${dir.src.java}" /> </target> </project> |