ANT实例脚本
<project name="bw_distribution_xh" default="bw.distribution.xh.update.hotfix" basedir=".">
??? <dirname property="bw.bw_distribution_xh.dir" file="${ant.file.bw_distribution_xh}"/>
??? <property file="${bw.bw_distribution_xh.dir}/build.properties"/>
??? <import file="${bw.bw_distribution_xh.dir}/distribution.xml"/>
???
??? <!--mkdir-->
??? <target name="bw.mkdir" description="Initialization">
?????? <mkdir dir="${hotfix_dest}\bw" />
??? </target>
???
??? <target name="admin.mkdir" description="Initialization">
??? ?? <mkdir dir="${hotfix_dest}\admin" />
??? </target>
???
??? <!--unzip-->
??? <target name="bw.TIB.bw.distribution.unzip">
??????? <unzip src="${hotfix_name}" dest="${hotfix_dest}\bw" />
??? </target>
???
???? <target name="admin.TIB.admin.distribution.unzip">
??????? <unzip src="${hotfix_name_admin}" dest="${hotfix_dest}\admin" />
??? </target>
???
??? <target name="bw.hotfix.unzip">
?????? <unzip src="${bw_hotfix}" dest="${bw_hotfix_dest}" />
?????? <echo>${bw_hotfix}</echo>
????? <delete file="${bw_hotfix}"/>
??? </target>
???
??? <target name="bw.distribution.get.xh.name">
??? ?<substring text="${bw.installer.name}" start="4"? property="subtext" />
??????? <property name="bw.distribution.xh.name"
????????????????? value="${dest}/${prefix}_bw_${bw.installer.version}.${bw.hotfix.version}_${bw.installer.platform}_distribution_gridlib"/>
??? </target>
??? <target name="bw.distribution.xh.update.hotfix" depends="bw.mkdir, admin.mkdir, bw.TIB.bw.distribution.unzip, admin.TIB.admin.distribution.unzip, bw.hotfix.unzip, bw.distribution.get.name, bw.distribution.get.xh.name">
????? <echo>${bw.distribution.name}</echo>
????? <property name="bw.xh.work.dir" value="${bw.distribution.xh.name}"/>
????? <mkdir dir="${bw.xh.work.dir}"/>
????? <echo>${bw.xh.work.dir}</echo>
????? <unzip src="${bw.distribution.name}" dest="${bw.xh.work.dir}"/>
????? <!--unzip src="${hotfix.name}"??????? dest="${bw.xh.work.dir}"/-->
????? <replaceregexp match="<grid-library-version>.*</grid-library-version>"
??????????????????????? replace="<grid-library-version>${bw.installer.version}.${bw.hotfix.version}</grid-library-version>" byline="true">
????????????? <fileset file="${bw.xh.work.dir}/grid-library.xml"/>
????? </replaceregexp>
?????
?????? <copy todir="${bw.xh.work.dir}/bw/5.9/hotfix">
???? ?<fileset dir="${bw_copy_Original_hotfix}" />
???? </copy>
?????
????? <copy todir="${admin_copy_New_hotfix}"? file="${admin_copy_Original_hotfix}" >
???? </copy>
????? <zip destfile="${bw.distribution.xh.name}.zip">
??????????? <zipfileset dir="${bw.xh.work.dir}"/>
????? </zip>
????? <delete dir="${bw.xh.work.dir}"/>
??? </target>
</project>
?
http://www.ibm.com/developerworks/cn/java/j-lo-ant-eclipse/??? 经典的文章!!