Ant内置任务之fail
2018-01-15 15:59
399 查看
一、概述
fail是Ant内置任务,用于退出当前构建,同时还可以选择输出一些额外信息。异常的信息可以通过message属性或者嵌套文本中设置。从Ant1.6.2开始,可以使用嵌套的condition元素来实现失败的条件,代替if/unless属性。condition中包含一个核心或自定义的条件。二、属性
message:当退出构建时提供的额外信息。if:如果当前project中存在指定名字的属性,则失败。
unless:如果当前project中不存在指定名字的属性,则失败。
status:Ant1.6.2引入,使用指定的状态码退出。如果生成的异常没有被捕获,JVM会以这个状态码退出。
三、简单示例
<project> <fail message="property test not set." unless="test"/> <fail message="property test1 not set." > <condition> <not> <isset property="test1"/> </not> </condition> </fail> <fail message="something additional." /> </project>
相关文章推荐
- Ant内置任务之input
- Ant内置任务之dependset
- Ant内置任务之sequential
- Ant内置任务之presetdef
- Ant内置任务之hostinfo
- Ant内置任务之condition
- Ant内置任务之sync
- Ant内置任务之concat
- Ant内置任务之echoproperties
- Ant内置任务之truncate
- Ant内置任务之xslt/style
- Ant内置任务之unjar/untar/unwar/unzip
- Ant内置任务之loadresource
- Ant内置任务之tstamp
- Ant全攻略2---Ant中的内置任务
- Ant内置任务之echoxml
- Ant内置任务之splash
- Ant内置任务之retry
- Ant内置任务之include
- Ant内置任务之bindtargets