<project name="experiment" default="full-build">
<property name="junit.dir" location=""/>
<property name="src.dir" value="src" />
<property name="lib.dir" value="lib"/>
<property name="build.dir" location="build"/>
<property name="build.test.classes.dir" location="${build.dir}/test/classes"/>
<property name="build.test.output.dir" location="${build.dir}/test/output"/>
<property name="src.unit-test.dir" location="test.src"/>
<path id="build-classpath">
<fileset dir="${lib.dir}" includes="*.jar" />
</path>
<path id="test-classpath">
<fileset dir="${lib.dir}" includes="*.jar" />
<path location="${build.dir}"/>
<path location="${build.test.classes.dir}"/>
</path>
<target name="full-build" depends="clean, init, compile-main, test" />
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.test.classes.dir}"/>
<mkdir dir="${build.test.output.dir}"/>
</target>
<target name="compile-main" depends="init">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build-classpath" />
<mkdir dir="${project.build.outputDirectory}/..datastore" />
<copy todir="${project.build.outputDirectory}/../config">
<fileset dir="config" />
</copy>
</target>
<target name="test" depends="compile-test">
<junit printsummary="yes" failureproperty="test.fail" fork="true" haltonfailure="yes" dir="${junit.dir}">
<classpath refid="test-classpath"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${build.test.output.dir}">
<fileset dir="${src.unit-test.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="compile-test" depends="compile-main">
<javac srcdir="${src.unit-test.dir}" destdir="${build.test.classes.dir}" classpathref="test-classpath" />
</target>
</project>
Thursday, 20 August 2009
A sample ant build file
Subscribe to:
Post Comments (Atom)
To include another build file for macros & other tasks:
ReplyDelete< import file="auto-deploy-build.xml" >