Ant脚本使用
<project name="ant-project" default="main"> <property name="home" value="."/> <property name="thirdparty" value="${home}/thirdparty"/> <property name="src" value="${home}/build/src"/> <property name="jaroutput" value="${home}/build"/> <property name="zipoutput" value="${home}/output"/> <property name="sqlfiles" value="${home}/sql"/> <property name="toolsfiles" value="${zipoutput}/tools"/> <property name="manualdoc" value="${zipoutput}/manual"/> <property name="classes" value="${home}/classes"/> <property name="jar-output-file-name" value="jar-test.jar"/> <property name="zip-output-file-name" value="zip-test.zip"/> <property name="output-file-name" value="output.zip"/> <!-- 清空操作 拷贝操作 --> <target name="clean"> <mkdir dir="${classes}" /> <delete includeEmptyDirs="true"> <fileset dir="${classes}" includes="**/*" /> </delete> <mkdir dir="${jaroutput}/sql" /> <delete includeEmptyDirs="true"> <fileset dir="${jaroutput}/sql" includes="**/*" /> </delete> <mkdir dir="${zipoutput}" /> <delete includeEmptyDirs="true"> <fileset dir="${zipoutput}" includes="**/*" /> </delete> <delete file="${jaroutput}/${jar-output-file-name}"/> <delete file="${zipoutput}/${zip-output-file-name}"/> <delete file="${zipoutput}/${output-file-name}"/> <mkdir dir="${manualdoc}" /> <copy todir="${manualdoc}"> <fileset dir="${home}/manual" includes="*.*"/> </copy> </target> <!-- 编译 --> <target name="compile"> <mkdir dir="${classes}"/> <javac destdir="${classes}" debug="on"> <classpath> <fileset dir="${thirdparty}"> <include name="**/*.jar"/> </fileset> </classpath> <src path="${src}"/> <include name="**"/> </javac> <copy todir="${classes}"> <fileset dir="${src}" includes="**/*.properties **/*.dtd **/*.xml"/> </copy> </target> <!-- jar打包--> <target name="jar" depends="clean,compile"> <jar destfile="${jaroutput}/${jar-output-file-name}" basedir="${classes}" includes="**/*"> <manifest> <attribute name="Main-Class" value="com.common.version.Version"/> </manifest> </jar> <copy todir="${jaroutput}/sql"> <fileset dir="${sqlfiles}" includes="**/*.sql"/> </copy> </target> <!-- 主要 入口--> <target name="main" depends="jar"> <zip destfile="${zipoutput}/${zip-output-file-name}" basedir="${jaroutput}" excludes="src/**"/> <zip destfile="${output-file-name}" basedir="${zipoutput}" excludes="${output-file-name}/**"/> <delete dir="${classes}" /> <delete dir="${jaroutput}/sql" /> <delete file="${jaroutput}/${jar-output-file-name}"/> </target> </project>
相关推荐
BitsPlayer 2020-05-29
roygbip 2020-02-16
BitsPlayer 2020-02-13
lrcoop 2020-02-03
chichichi0 2020-01-06
BitsPlayer 2019-12-19
BitsPlayer 2019-12-14
xueliangEmail 2013-07-22
cailianren 2010-04-15
wugang0 2019-11-09
lustdevil 2011-08-28
evilvoid 2008-04-17
leonranri 2019-11-05
leeccr 2019-10-31
evilvoid 2010-02-02