---
title: "ANT实例脚本"
author: "aa00aa00"
date: "2011-08-30T10:59:46Z"
tags: []
categories: ["开源软件"]
slug: "ant"
draft: false
lastmod: "2011-08-30T16:02:13Z"
id: 1161171
url: "https://aa00aa00.iteye.com/blog/1161171"
---

&lt;project name="bw\_distribution\_xh" default="bw.distribution.xh.update.hotfix" basedir="."&gt;

    &lt;dirname property="bw.bw\_distribution\_xh.dir" file="${ant.file.bw\_distribution\_xh}"/&gt;  
    &lt;property file="${bw.bw\_distribution\_xh.dir}/build.properties"/&gt;  
    &lt;import file="${bw.bw\_distribution\_xh.dir}/distribution.xml"/&gt;  
     
    &lt;!--mkdir--&gt;  
    &lt;target name="bw.mkdir" description="Initialization"&gt;  
       &lt;mkdir dir="${hotfix\_dest}\\bw" /&gt;  
    &lt;/target&gt;  
     
    &lt;target name="admin.mkdir" description="Initialization"&gt;  
       &lt;mkdir dir="${hotfix\_dest}\\admin" /&gt;  
    &lt;/target&gt;  
     
    &lt;!--unzip--&gt;  
    &lt;target name="bw.TIB.bw.distribution.unzip"&gt;  
        &lt;unzip src="${hotfix\_name}" dest="${hotfix\_dest}\\bw" /&gt;  
    &lt;/target&gt;  
     
     &lt;target name="admin.TIB.admin.distribution.unzip"&gt;  
        &lt;unzip src="${hotfix\_name\_admin}" dest="${hotfix\_dest}\\admin" /&gt;  
    &lt;/target&gt;  
     
    &lt;target name="bw.hotfix.unzip"&gt;  
       &lt;unzip src="${bw\_hotfix}" dest="${bw\_hotfix\_dest}" /&gt;  
       &lt;echo&gt;${bw\_hotfix}&lt;/echo&gt;  
      &lt;delete file="${bw\_hotfix}"/&gt;  
    &lt;/target&gt;  
     
    &lt;target name="bw.distribution.get.xh.name"&gt;  
     &lt;substring text="${bw.installer.name}" start="4"  property="subtext" /&gt;  
        &lt;property name="bw.distribution.xh.name"  
                  value="${dest}/${prefix}\_bw\_${bw.installer.version}.${bw.hotfix.version}\_${bw.installer.platform}\_distribution\_gridlib"/&gt;  
    &lt;/target&gt;

    &lt;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"&gt;  
      &lt;echo&gt;${bw.distribution.name}&lt;/echo&gt;  
      &lt;property name="bw.xh.work.dir" value="${bw.distribution.xh.name}"/&gt;  
      &lt;mkdir dir="${bw.xh.work.dir}"/&gt;  
      &lt;echo&gt;${bw.xh.work.dir}&lt;/echo&gt;  
      &lt;unzip src="${bw.distribution.name}" dest="${bw.xh.work.dir}"/&gt;  
      &lt;!--unzip src="${hotfix.name}"        dest="${bw.xh.work.dir}"/--&gt;  
      &lt;replaceregexp match="&lt;grid-library-version&gt;.\*&lt;/grid-library-version&gt;"  
                        replace="&lt;grid-library-version&gt;${bw.installer.version}.${bw.hotfix.version}&lt;/grid-library-version&gt;" byline="true"&gt;  
              &lt;fileset file="${bw.xh.work.dir}/grid-library.xml"/&gt;  
      &lt;/replaceregexp&gt;  
       
       &lt;copy todir="${bw.xh.work.dir}/bw/5.9/hotfix"&gt;  
      &lt;fileset dir="${bw\_copy\_Original\_hotfix}" /&gt;  
     &lt;/copy&gt;  
       
      &lt;copy todir="${admin\_copy\_New\_hotfix}"  file="${admin\_copy\_Original\_hotfix}" &gt;  
     &lt;/copy&gt;

      &lt;zip destfile="${bw.distribution.xh.name}.zip"&gt;  
            &lt;zipfileset dir="${bw.xh.work.dir}"/&gt;  
      &lt;/zip&gt;  
      &lt;delete dir="${bw.xh.work.dir}"/&gt;  
    &lt;/target&gt;

&lt;/project&gt;

 

[http://www.ibm.com/developerworks/cn/java/j-lo-ant-eclipse/](http://www.ibm.com/developerworks/cn/java/j-lo-ant-eclipse/)    经典的文章!!