`

Ant的使用--创建、删除目录、编译、打包、运行等

阅读更多
<?xml version="1.0" encoding="UTF-8"?>

<project name="AntDemo" default="compile" basedir=".">
    <property name="src" location="./src"/>
    <property name="build" location="./WEB-INF/classes"/>
    <property name="dist" location="./WEB-INF/lib"/>
   
    <!-- Generate directory -->
    <target name="init">
        <tstamp/>
        <mkdir dir="${build}"/>
    </target>

    <!-- compile java -->
    <target name="compile" depends="init">
        <javac srcdir="${src}" destdir="${build}"/>
    </target>
   
    <!-- jar -->
    <target name="dist" depends="compile">
        <mkdir dir="${dist}"/>
        <jar jarfile="${dist}/dist-${DSTAMP}.jar" basedir="${build}"/>
    </target>
   
    <!-- clean -->
    <target name="clean">
        <delete dir="${build}"/>
        <delete dir="${dist}"/>
    </target>
   
    <!-- run -->
    <target name="run">
        <java classpath="${build}" classname="com.taoistwar.HelloWorld" fork="true"/>
    </target>
   
</project>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics