ITeye博客

Ant的常用任务

easy0917 · 2010-02-04 23:21 · Ant · 编程语言 · Markdown

  1.   copy任务
    

该任务主要用来对文件和目录的复制功能。举例如下:

Eg1.复制单个文件:

<copy file="file.txt" tofile="copy.txt"/>

Eg2.对文件目录进行复制:

 <copy todir="../newdir/dest_dir">

            <fileset dir="src_dir"/>

 </copy>

Eg3. 将文件复制到另外的目录:

 <copy file="file.txt" todir="../other/dir"/>
  1.   delete任务
    

对文件或目录进行删除,举例如下:

Eg1. 删除某个文件:

<delete file="photo/amigo.jpg"/>

Eg2. 删除某个目录:

<delete dir="photo"/>

Eg3. 删除所有的备份目录或空目录:

  <delete includeEmptyDirs="true">

               <fileset dir="." includes="**/*.bak"/>

        </delete>
  1.   mkdir任务
    

创建目录。eg:

<mkdir dir="build"/>
  1.   move任务
    

移动文件或目录,举例如下:


Eg1. 移动单个文件:

Eg2. 移动单个文件到另一个目录:

Eg3. 移动某个目录到另一个目录:

 <move todir="newdir">

               <fileset dir="olddir"/>

        </move>

  1.   echo任务
    

该任务的作用是根据日志或监控器的级别输出信息。它包括message、file、append和level四个属性,举例如下:

<echo message="Hello,Amigo" file="logs/system.log" append="true">

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。