<!-- Ant Skeleton-->
<!--Example 3-1. Complete buildfile for the irssibot project-->
<?xml version="1.0"?>
<!-- Comments are just as important in buildfiles, do not -->
<!-- avoid writing them! -->
<!-- Example build file for "Ant: The Definitive Guide" -->
<project name="irssibot" default="all" basedir=".">
<!-- Project-wide settings. All directories are relative to the -->
<!-- project directories -->
<property name="src.dir" value="src"/>
<property name="doc.dir" value="doc"/>
<property name="dist.dir" value="dist"/>
<property name="lib.dir" value="lib"/>
<property name="bin.dir" value="bin"/>
<!-- Build directories -->
<property name="build.dir" value="build"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.doc" value="${build.dir}/doc"/>
<property name="build.lib" value="${build.dir}/lib"/>
<!-- Global settings -->
<property name="debug.flag" value="on"/>
<property name="java.lib" value="${java.home}/jre/lib/rt.jar"/>
<!-- Global property for <javac> -->
<property name="build.compiler" value="modern"/>
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="prepare">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.lib}"/>
<tstamp/>
<echo message="${TSTAMP}"/>
</target>
<target name="all" depends="bot,modules"/>
<!-- Build the IRC bot application -->
<target name="bot" depends="prepare">
<mkdir dir="${build.classes}"/>
<javac destdir="${build.classes}"
debug="${debug.flag}"
deprecation="on">
<!-- We could have used javac's srcdir attribute -->
<src path="${src.dir}"/>
<exclude name="irssibot/modules/**"/>
<classpath refid="classpath"/>
</javac>
<jar jarfile="${build.lib}/irssibot.jar"
basedir="${build.classes}" >
<exclude name="irssibot/modules/**"/>
</jar>
</target>
<!-- Build the IRC bot modules -->
<target name="modules" depends="prepare,bot">
<mkdir dir="${build.classes}/modules"/>
<javac destdir="${build.classes}/modules"
debug="${debug.flag}"
deprecation="on" >
<!-- We could have used javac's srcdir attribute -->
<src path="${src.dir}"/>
<include name="irssibot/modules/**"/>
<classpath refid="classpath"/>
</javac>
<jar jarfile="${build.lib}/irssimodules.jar"
basedir="${build.classes}/modules"
manifest="MANIFEST.MF" >
<manifest>
<attribute name="ModuleType" value="irssibot"/>
</manifest>
<include name="irssibot/modules/**"/>
</jar>
</target>
<!-- Deploy the application in a "ready-to-run" state -->
<target name="deploy" depends="bot,javadoc">
<!-- Create the distribution directory -->
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${dist.dir}/doc"/>
<mkdir dir="${dist.dir}/config"/>
<!-- Copy the primary program and modules -->
<copy todir="${dist.dir}/lib">
<fileset dir="${build.classes}"/>
<fileset dir="${build.lib}" includes="irssibot.jar"/>
<fileset dir="${build.lib}" includes="irssimodules.jar"/>
<fileset dir="${lib.dir}" includes="*.jar"/>
</copy>
<!-- Copy the documentation -->
<copy todir="${dist.dir}/doc">
<fileset dir="${doc.dir}"/>
</copy>
<!-- Copy the pre-fab configuration files -->
<copy todir="${dist.dir}/config">
<fileset dir="${lib.dir}" includes="*.xml"/>
</copy>
<!-- Copy the running scripts -->
<copy todir="${dist.dir}/bin">
<fileset dir="${bin.dir}" includes="bot.sh"/>
<fileset dir="${bin.dir}" includes="bot.bat"/>
</copy>
</target>
<!-- Generate the API documentation for the IRC library and the -->
<!-- IRC bot using the library -->
<target name="javadoc" depends="bot">
<mkdir dir="${doc.dir}/api"/>
<javadoc packagenames="irssibot.*"
sourcepath="${src.dir}"
destdir="${doc.dir}/api"
classpath="${lib.dir}/xerces.jar:${lib.dir}/mysql.jar"
author="true"
version="true"
use="true" />
</target>
<!-- Delete class files built during previous builds. Leave
directories -->
<target name="clean">
<delete>
<fileset dir="${build.classes}" includes="**/*.class"/>
</delete>
<delete dir="${doc.dir}/api"/>
</target>
<!-- Delete any created directories and their contents -->
<target name="cleanall" depends="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${doc.dir}/api"/>
</target>
</project>
本文地址:http://com.8s8s.com/it/it12499.htm