<?xml version="1.0" encoding="UTF-8"?>
<project name="Hello world" default="all" basedir=".">
<!-- property -->
<property name="src.dir" value="src" />
<property name="lib.dir" value="lib" />
<property name="classes.dir" value="classes" />
<property name="dist.dir" value="dist" />
<property name="report.dir" value="report"></property>
<!--classpath -->
<path id="master-classpath">
<fileset dir="${lib.dir}/xml">
<include name="xml-apis.jar" />
</fileset>
<fileset dir="${lib.dir}/jdbc">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.dir}/junit">
<include name="**/*.jar" />
</fileset>
</path>
<!--init task -->
<target name="init"></target>
<!--clean -->
<target name="clean" description="clean up the output dir">
<delete dir="${classes.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${report.dir}" />
</target>
<!--compile -->
<target name="compile" description="compile the project">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" target="1.5"
debug="true">
<classpath refid="master-classpath" />
</javac>
<copy todir="${classes.dir}" preservelastmodified="true">
<fileset dir="${src.dir}">
<include name="**/*.java" />
<include name="**/*.properties" />
<include name="**/*.xml" />
</fileset>
</copy>
</target>
<target name="junit" description="run junit test">
<mkdir dir="${report.dir}" />
<junit printsummary="true" showoutput="true"
haltonfailure="true">
<classpath>
<pathelement location="${classes.dir}" />
<fileset dir="${lib.dir}/junit">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="plain" />
<batchtest fork="true" todir="${report.dir}">
<fileset dir="${classes.dir}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<target name="build" description="create jar file">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/hello.jar"
basedir="${classes.dir}">
<exclude name="**/*.java" />
</jar>
</target>
<target name="all">
<antcall target="clean" />
<antcall target="compile" />
<antcall target="junit" />
<antcall target="build" />
</target>
</project>
<project name="Hello world" default="all" basedir=".">
<!-- property -->
<property name="src.dir" value="src" />
<property name="lib.dir" value="lib" />
<property name="classes.dir" value="classes" />
<property name="dist.dir" value="dist" />
<property name="report.dir" value="report"></property>
<!--classpath -->
<path id="master-classpath">
<fileset dir="${lib.dir}/xml">
<include name="xml-apis.jar" />
</fileset>
<fileset dir="${lib.dir}/jdbc">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.dir}/junit">
<include name="**/*.jar" />
</fileset>
</path>
<!--init task -->
<target name="init"></target>
<!--clean -->
<target name="clean" description="clean up the output dir">
<delete dir="${classes.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${report.dir}" />
</target>
<!--compile -->
<target name="compile" description="compile the project">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" target="1.5"
debug="true">
<classpath refid="master-classpath" />
</javac>
<copy todir="${classes.dir}" preservelastmodified="true">
<fileset dir="${src.dir}">
<include name="**/*.java" />
<include name="**/*.properties" />
<include name="**/*.xml" />
</fileset>
</copy>
</target>
<target name="junit" description="run junit test">
<mkdir dir="${report.dir}" />
<junit printsummary="true" showoutput="true"
haltonfailure="true">
<classpath>
<pathelement location="${classes.dir}" />
<fileset dir="${lib.dir}/junit">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="plain" />
<batchtest fork="true" todir="${report.dir}">
<fileset dir="${classes.dir}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<target name="build" description="create jar file">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/hello.jar"
basedir="${classes.dir}">
<exclude name="**/*.java" />
</jar>
</target>
<target name="all">
<antcall target="clean" />
<antcall target="compile" />
<antcall target="junit" />
<antcall target="build" />
</target>
</project>