<?xml version="1.0" encoding="GBK" ?>java
<!--default="clean"定義ant運行到target clean這一步結束-->
<project name="projectName" default="clean" basedir="D:\workspace\logistics">
<description>projectName系統發佈</description>
<!--屬性設置-->
<property environment="env" />
<property name="src.dir" value="${basedir}/build/src" />
<property name="jar.file" value="tmsclient.jar" />
<property name="java.lib.dir" value="${env.JAVA_HOME}/lib" />
<property name="build.dir" value="${basedir}/build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="dist.dir" value="${basedir}" />
<property name="lib.dir" value="${basedir}\logistics\WEB-INF\lib" />
<path id="compile.classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<!-- 運行路徑設置 -->
<!--path id="run.classpath">
<path refid="compile.classpath" />
<pathelement location="${classes.dir}" />
</path-->
<!-- 排除java源文件的模式集 -->
<patternset id="no.java">
<exclude name="**/*.java" />
</patternset>
<!-- 初始化,創建目錄,將多個src目錄複製到同一src目錄,編譯,打包完成後自動清除 -->
<target name="init" description="初始化,創建目錄,複製文件">
<mkdir dir="${classes.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${src.dir}" />
<copy todir="${src.dir}">
<fileset dir="${basedir}/src/tms/entity">
<include name="**/*.java" />
</fileset>
</copy>
<copy todir="${src.dir}">
<fileset dir="${basedir}/src/tms/hessianclient">
<include name="**/*.java" />
</fileset>
</copy>
<copy todir="${src.dir}/tms/hessianclient">
<fileset dir="${basedir}/src/tms/hessianclient">
<include name="**/*.xml" />
</fileset>
</copy>
<copy todir="${src.dir}/tms/hessianclient">
<fileset dir="${basedir}/src/tms/hessianclient">
<include name="**/*.properties" />
</fileset>
</copy>
<copy todir="${src.dir}">
<fileset dir="${basedir}/src/tms/interfaces">
<include name="**/*.java" />
</fileset>
</copy>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<patternset refid="no.java" />
</fileset>
</copy>
</target>
<!-- 編譯源文件-->
<target name="compile" depends="init" description="編譯源文件">
<javac srcdir="${src.dir}" destdir="${classes.dir}" source="1.6" target="1.6" includeantruntime="on" >
<classpath refid="compile.classpath" />
</javac>
</target>
<!-- 打包類文件 -->
<target name="jar" depends="compile" description="打包類文件">
<jar jarfile="${dist.dir}/${jar.file}" >
<fileset dir="${classes.dir}" includes="**/*.*" />
</jar>
</target>
<!-- 清理,刪除臨時目錄 -->
<target name="clean" depends="jar" description="清理,刪除臨時目錄">
<delete dir="${build.dir}" />
<delete dir="${basedir}/.settings" />
<delete dir="${src.dir}" />
<delete dir="${basedir}/bin" />
<echo level="info">清理完畢</echo>
</target>
<!-- 從打包後jar的文件裏運行 -->
<!--target name="runjar" depends="jar" description="運行jar">
<java jar="${dist.dir}/${jar.file}" fork="yes" dir="${basedir}" />
</target-->
<!-- 運行 -->
<!--target name="run" depends="compile" description="運行">
<java classname="powerwind.Sample" fork="yes" dir="${basedir}">
<classpath refid="run.classpath" />
<arg line="${param.msg}" />
</java>
</target-->
</project> ui