<?xml version="1.0" encoding="gb2312"?>
<project name="Test Project" default="all" basedir=".">
<property name="src.code" value="src"/>
<property name="src.junit" value="junit"/>
<property name="lib.dir" value="lib"/>
<property name="lib.jar" value="TestClass.jar"/>
<!-- checkstyle configuration -->
<property name="checkstyle.config" value="checkstyle.xml"/>
<taskdef resource="checkstyletask.properties"
classpath="${lib.dir}/checkstyle-all-3.1.jar"/>
<!-- 输出文档 -->
<property name="doc.dir" value="doc"/>
<property name="doc.api" value="${doc.dir}/api"/>
<property name="javadoc.package" value="com.*"/>
<!-- 输出二进制文件 -->
<property name="dist.root" value="dist"/>
<property name="dist.proj" value="${dist.root}/proj"/>
<property name="dist.classes" value="${dist.proj}/classes"/>
<property name="dist.lib" value="${dist.proj}/lib"/>
<property name="dist.junit" value="${dist.root}/junit"/>
<!-- classpath -->
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="proj.libs">
<fileset dir="${dist.lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="init">
<mkdir dir="${doc.dir}"/>
<mkdir dir="${dist.root}"/>
<mkdir dir="${dist.proj}"/>
<mkdir dir="${dist.lib}"/>
<tstamp/>
<echo message="${TSTAMP}"></echo>
</target>
<target name="all" depends="compilesrc, javadoc, checkstyle"/>
<!-- 编译源文件 -->
<target name="compilesrc" depends="init">
<mkdir dir="${dist.classes}"/>
<javac destdir="${dist.classes}" deprecation="on">
<src path="${src.code}"/>
<classpath refid="classpath"/>
</javac>
<jar jarfile="${dist.lib}/${lib.jar}" basedir="${dist.classes}">
<include name="**/*.class"/>
</jar>
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/