读书人

最全的Ant封装命令

发布时间: 2012-10-12 10:17:04 作者: rapoo

最全的Ant打包命令
<project name="MQ API" default="dist" basedir="./">
<!-- set the Project resource Path -->
<property environment="env" />
<property name="src" value="../src" />
<property name="lib" value="../lib" />
<property name="bin" value="../bin" />
<property name="dist" value="../classes" />

<property name="jarfile" value="MQ_API.jar" />

<!-- Set the start Time -->
<target name="init">
<tstamp>
<format property="build.time" pattern="yyyy-MM-dd HH:mm:ss aa">
</format>
</tstamp>
<echo message="build time:${build.time}" />
<concat destfile="${bin}/build_oracle.log">build time : ${build.time}></concat>
</target>

<!-- delete the dist dir -->
<target name="clean" depends="init">
<delete dir="${dist}" />
<delete dir="${bin}/${jarfile}" />
</target>
<!-- create the dist dir -->
<target name="prepare" depends="clean">
<mkdir dir="${dist}" />
</target>

<target name="compile" depends="prepare">
<javac srcdir="${src}" destdir="${dist}" debug="true" debuglevel="lines,vars,source" encoding="UTF-8" nowarn="true" memoryMaximumSize="512M" fork="true">
<classpath>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>

</javac>

<copy todir="${dist}">
<fileset dir="${src}">
<exclude name="**/*.java" />
<exclude name="**/vssver.scc" />
<exclude name="**/CVS/**" />
<exclude name="**/svn/**" />
</fileset>
</copy>
</target>

<target name="decompress">
<unjar src="${lib}\CL3Export.jar" dest="${dist}" />
<unjar src="${lib}\CL3Nonexport.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.commonservices.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.defaultconfig.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.fta.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.headers.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.jmqi.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.jms.Nojndi.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.pcf.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.postcard.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.soap.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mq.tools.ras.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mqjms.jar" dest="${dist}" />
<unjar src="${lib}\com.ibm.mqetclient.jar" dest="${dist}" />
<unjar src="${lib}\commons-fileupload-1.0-beta-1.jar" dest="${dist}" />
<unjar src="${lib}\ConfigManagerProxy.jar" dest="${dist}" />
<unjar src="${lib}\connector.jar" dest="${dist}" />
</target>

<target name="dist" depends="compile,decompress">
<jar jarfile="${jarfile}" basedir="${dist}" >
<manifest>
<attribute name="Main-Class" value="com.huawei.common.EncryptUtil" />
<!-- finally, use the magically generated libs path -->
<attribute name="Class-Path" value="" />
</manifest>
</jar>
<delete dir="${dist}" />
</target>


</project>

读书人网 >编程

热点推荐