ant -f build.xml  执行你的build.xml文件
 
<?xml version = "1.0"?>
<project name = "fax" basedir = "./" default = "start">
<!--使用for循环必须要加上这个-->
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
 
<!-- 定义属性 -->
<var name="targetsource" value="E:/ant/testSourse" />
<var name="source" value="E:/ant/apache-ant-1.9.2" />
<var name="removePath" value="E:/ant/testcode/source.properties" />
 
 
<!-- 开始执行的目标-->
<target name="start">
<!-- 获取当天的时间-->
<tstamp>
<format property="TODAY" pattern="yyyyMMdd"/>
</tstamp>
 
<!-- 创建测试目录-->
<antcall target="mkdir" ></antcall>
 
<!-- 拷贝测试文件-->
<antcall target="copy" ></antcall>
 
<!-- 删除测试文件-->
<antcall target="del" ></antcall>
 
<!-- 压缩文件文件-->
<antcall target="zip" ></antcall>
 
<!-- 删除除了zip外的文件 -->
<delete dir = "${targetsource}/sourse_${TODAY}"></delete>
 
</target>
 
<!-- 创建测试目录-->
<target name="mkdir">
<echo message = "begin mkdir"/>
<mkdir dir="${targetsource}/sourse_${TODAY}" />
<echo message = "end mkdir"/>
</target>
 
<!-- 拷贝文件及文件夹进行测试-->
<target name="copy">
<echo message = "begin copy"/>
<copy todir="${targetsource}/sourse_${TODAY}" overwrite="true" preservelastmodified="true">
<fileset dir="${source}"/>
</copy>
<copy todir="${targetsource}/sourse_${TODAY}" overwrite="true" preservelastmodified="true">
<fileset dir="E:/ant">
<include name="*.zip"/>
</fileset>
</copy>
<echo message = "end copy"/>
</target>
 
<!-- 删除部分文件-->
<target name="del">
<echo message = "begin del"/>
<loadproperties srcFile="${removePath}"/>
<for list="${files}" param="file1">
<sequential>
<delete dir = "${targetsource}/sourse_${TODAY}/@{file1}"> </delete>
</sequential>
</for>
<delete>
<fileset dir = "${targetsource}/sourse_${TODAY}">
<include name = "*.zip"/>
<include name="/apache-ant-1.9.2/**.*"/>
</fileset>
</delete>
<echo message = "end del"/>
</target>
 
<!-- 压缩文件-->
<target name="zip">
<!--
destfile 目标文件
duplicate 打包方式(一般使用preserve)
zipfileset 打包那些文件
prefix 增加前缀(使用最佳实践)
-->
<echo message = "begin zip"/>
<zip destfile="${targetsource}/sourse_${TODAY}.zip" duplicate="preserve" basedir="${targetsource}/sourse_${TODAY}" update="true"/>
<echo message = "end zip"/>
</target>
 
 
<!--拷贝ftp上的文件-->
<target name="ftpCopy" description="ftpCopy" >
<echo message = "in ftp server=${server} userid=${userid} password=${password} port=${port} remotedir=${remotedir} "/>
<ftp action="get"
server="${server}"
userid="${userid}"
password="${password}"
port="${port}"
remotedir="${remotedir}" >
<fileset dir="${source}\\NC_HOME_${TODAY}">
<include name="**"/>
</fileset>
</ftp>
</target>
 
</project>

Ant 基本语法的使用示列的更多相关文章

  1. ServiceStack Web Service 创建与调用简单示列

    目录 ServiceStack 概念 ServiceStack Web Service 创建与调用简单示列 上篇文章介绍了ServiceStack是什么,本章进入主题,如何快速简单的搭建Service ...

  2. Mysql有没有语法可以在增加列前进行判断该列是否存在

    Mysql没有直接的语法可以在增加列前进行判断该列是否存在,需要写一个存储过程完成同样任务,下面例子是:在sales_order表中增加一列has_sent列 drop procedure if ex ...

  3. systemd的新特性及unit常见类型分析与awk用法示列

    简述systemd的新特性及unit常见类型分析,能够实现编译安装的如nginx\apache实现通过systemd来管理 系统引导的新特性 系统引导时实现服务启动: 按需激活进程: 系统状态快照: ...

  4. java 散列与散列码探讨 ,简单HashMap实现散列映射表运行各种操作示列

    java 散列与散列码探讨 ,简单HashMap实现散列映射表运行各种操作示列 package org.rui.collection2.maps; /** * 散列与散列码 * 将土拔鼠对象与预报对象 ...

  5. Ant 常用语法及选项

    project 项目定义,一个ant文件就是一个 project,定义了项目名称,起始位置以及默认执行的 target. <project name="Easily" bas ...

  6. 智能提示含查询多列(html+JS+handler+ HttpRemoting)一、html示列 加 JS加 请求 Handler

    <html> <head> </head> <body> <form id="recordform" name="r ...

  7. TSQL--标示列、GUID 、序列

    --1. IDENTIY 列不能为空,不能设默认值,创建后不能使用ALTER TABLE TableName ALTER COLUMN修改,每张表只能有一个自增列--2. 查看当前值:SELECT I ...

  8. Flask视图之CBV示列

    from flask import views, Flask app=Flask(__name__) class loginview( views.MethodView ):   # 继承views. ...

  9. H3C路由器配置示列一

    说明: 如上图所示,192.168.0.0网段是总公司的网络,192.168.3.0和192.168.4.0网段是当前自己分公司的网络,且192.168.3.0是内网不能访问互联网,192.168.4 ...

随机推荐

  1. BlockingQueue<> 队列的作用

    BlockingQueue<> 队列的作用 BlockingQueue 实现主要用于生产者-使用者队列 BlockingQueue 实现主要用于生产者-使用者队列,BlockingQueu ...

  2. this的四种绑定形式

    一 , this的默认绑定 当一个函数没有明确的调用对象的时候,也就是单纯作为独立函数调用的时候,将对函数的this使用默认绑定:绑定到全局的window对象. 一个例子 function fire ...

  3. BZOJ2431_逆序对数列_KEY

    转自YXDs 题目传送门 不知道今天是怎么了,可能是空调吹多了吧,一直不在状态,连递推题我都做不来了--(扎Zn了老Fe--) 然而,不管环境如何恶劣,我们仍要努力学习,为了自己的明天而奋斗.(说的好 ...

  4. jquery对象和js对象

    <ul id="ul1">   <li id="li_1">01</li>   <li>02</li> ...

  5. Spring中的Service/DAO/DTO

  6. 解决外部编辑器修改Eclipse文件延迟刷新【补充】

    在之前的文章,使用gulp解决外部编辑器修改Eclipse文件延迟刷新,原理是用gulp把更改过的项目文件直接复制一份到Tomcat的webapp.root下, 现在补充另外一种方法,双击Server ...

  7. 洗礼灵魂,修炼python(5)--python操作符,内置函数

    前面提到了BIF(内置函数)这个概念,什么是内置函数,就是python已经定义好的函数,不需要人为再自己定义,直接拿来就可以用的函数,那么都有哪些BIF呢? 可以在交互式界面(IDLE)输入这段代码, ...

  8. PHP字符串函数-trim()实例用法

    string trim ( string $str [, string $charlist = " \t\n\r\0\x0B" ] )此函数返回字符串 str 去除首尾空白字符后的 ...

  9. Struts 关联DTD 文件

    Struts 的xml 文件在Eclipse 中  默认是不会有提示的. 但是我们可以关联DTD 文件, 这样子就可以出现如下的struts   提示了 1. 首先得先确保自己有Struts2 的Sr ...

  10. 和团队齐头并进——敏捷软件开发的Scrum的学习

    敏捷开发的介绍 概念 更强调程序员团队与业务专家之间的紧密协作.面对面的沟通(认为比书面的文档更有效).频繁交付新的软件版本.紧凑而自我组织型的团队.能够很好地适应需求变化的代码编写和团队组织方法,也 ...