Ant步步为营(1)解压本地的zip包

从毕业到现在做QA测试有段时间了,没有做开发真的有点遗憾,不过都过去了。工作期间对一些脚本产生了很大兴趣,于是开始了脚本的简单学习。

不多说:

在eclipse上新建一个ant project,新建一个,build.xml 文件(ant 默认情况下是执行build.xml文件)。

解压脚本如下:

<?xml version="1.0"?>
    <project name="ForTest" default="unzip" >
    <property file="build.properties"></property>
        <target name="unzip" description="unzip the zip package">
            <unzip dest="${file.dir}">
                <fileset dir="${file.dir}">
                    <include name="**/*.zip"/>
                </fileset>
            </unzip>
            </target>
        
    </project>

file.dir是本地的zip所在路径,build.properties是一个配置文件。file.dir可放到配置文件中,也可在脚本中直接写出,建议写到脚本。

posted @ 2014-04-28 16:34  javaTest  阅读(299)  评论(0编辑  收藏  举报