施用Ant编译java类

使用Ant编译java类

编写bulid.xml文件,将其放置项目根目录下

<project default="build">

    <!-- base on jdk1.5 & servlet 2.3 -->

    <property name="version" value=""/>
    <property name="libpath" location="WEB-INF/lib"/>

    <target name="compile">
            <delete dir="bin"/>
        <mkdir dir="bin"/>
        <javac srcdir="src" destdir="bin" source="1.5" target="1.5" debug="true" encoding="utf-8">
            <classpath>
                <fileset dir="${libpath}">
                    <include name="*.jar"/>
                </fileset>
            </classpath>
        </javac>    
    </target>

        <target name="build" depends="compile">
            <copy todir="bin">
                <fileset dir="src" excludes="**/*.java"/>
            </copy>                    
    </target>