ANT编译打包

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="JAR_COMMONS_DREAM_LANG" name="commons-dream-lang">

    <property name="COMMONS-DREAM-LANG-SRC.DIR" value="src" />
    <property name="COMMONS-DREAM-LANG-CLASSES.DIR" value="build/classes" />
    <property name="LIB_PATH" value="${basedir}/WebContent/WEB-INF/LIB" />
    <property name="DEBUGLEVEL" value="source,lines,vars" />
    <property name="TARGET" value="1.6" />
    <property name="SOURCE" value="1.6" />
    <property name="JAR_FILE" value="commons-dream-lang.jar" />
    <property name="JAR_SRC_FILE" value="commons-dream-lang-src.jar" />

    <path id="COMMONS-DREAM-LANG.CLASSPATH">
        <fileset dir="${LIB_PATH}">
            <include name="/**/*.jar" />
        </fileset>
    </path>

    <target name="init">
        <delete dir="${COMMONS-DREAM-LANG-CLASSES.DIR}" />
        <delete file="${JAR_FILE}" />
        <delete file="${JAR_SRC_FILE}" />
        <mkdir dir="${COMMONS-DREAM-LANG-CLASSES.DIR}" />
    </target>

    <target name="compile" depends="init">
        <javac debuglevel="${DEBUGLEVEL}" destdir="${COMMONS-DREAM-LANG-CLASSES.DIR}" source="${SOURCE}" target="${TARGET}"
            includeantruntime="false" debug="true">
            <compilerarg value="-Xlint:unchecked" />
            <src path="${COMMONS-DREAM-LANG-SRC.DIR}" />
            <classpath refid="COMMONS-DREAM-LANG.CLASSPATH" />
        </javac>
    </target>

    <target name="jar" depends="compile">
        <jar destfile="${JAR_FILE}" basedir="${COMMONS-DREAM-LANG-CLASSES.DIR}">
            <manifest>
                <attribute name="Class-Path" value="${COMMONS-DREAM-LANG.CLASSPATH}" />
            </manifest>
        </jar>
    </target>
    <target name="clean" depends="compile">
        <delete dir="${COMMONS-DREAM-LANG-CLASSES.DIR}" />
    </target>
    <target name="jar_src" depends="compile">
        <jar destfile="${JAR_SRC_FILE}" basedir="${COMMONS-DREAM-LANG-SRC.DIR}" />
    </target>
    <target name="JAR_COMMONS_DREAM_LANG" depends="init,compile,jar,jar_src,clean" />
</project>
 

相关推荐