Chinaunix首页 | 论坛 | 博客
  • 博客访问: 472843
  • 博文数量: 122
  • 博客积分: 1403
  • 博客等级: 中尉
  • 技术积分: 1668
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-11 13:31
文章分类

全部博文(122)

文章存档

2018年(5)

2017年(12)

2014年(15)

2013年(33)

2012年(4)

2011年(53)

分类: Python/Ruby

2011-03-03 17:26:13

手册资料:
 
每个build文件包含一个project和至少一个target,targets 包含任务元素。

一个Project包含三种属性:

Attribute Description Required
name 项目名称 No
default 当没有设置时,缺省的target。 No; however, since Ant 1.6.0, 之前的至少需要一个
basedir 用于计算所有其他路径的基路径;该属性可以被basedir property覆盖。当被覆盖时,basedir被忽略。如果basedirbasedir property都没有设定,就使用build文件的父目录 No

 一个target是一系列你要去执行的任务. Ant开始工作时,可以选择执行特定的target.

一个target可以依赖其他的target。例如,有一个target用于编译程序,一个target用于生成可执行文件。在生成可执行文件之前必须先编译通过,所以生成可执行文件的target依赖于编译targetAnt会处理这种依赖关系。

一个task是一个可执行的代码块。

Tasks 的通用结构是 common structure:

<name attribute1="value1" attribute2="value2" ... />

name 是task的名称, attributeN 是属性名, and valueN 是对应属性的值.>

有一系列的 (内置task,这个链接在工作中会经常用到:)), 同时,也可以很容易的写自己的task( write your own).

 

属性是一个重要的定制构建过程的方法,个属性有一个名称和一个值.属性名称是大小写敏感的。  This is done by placing the property name between "${" and "}" in the attribute value. For example, if there is a "builddir" property with the value "build", then this could be used in an attribute like this: ${builddir}/classes. This is resolved at run-time as build/classes.

simple example build file 说明:这行是注释 说明:建立目录build 说明:编译src目录下的java代码,并把编译后生成的.class放到build目录 说明l:在dist目录下建立子目录/lib 说明:上一行用于制作可执行的JAR文件包,经本人在本机测试,这样实际上会报错, 需加上manifest任务才行(在后续一个博文中用详细例子说明)
阅读(473) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~