Apache Ant Tasks 简明教程

Apache Ant Tasks - Sleep

Description

Sleep 任务用于在短时间内休眠,当构建或部署过程需要在任务之间设置时间间隔时,此任务非常有用。

Sleep task is for sleeping a short period of time, useful when a build or deployment process requires an interval between tasks.

Properties

Sr.No

Attributes & Description

1

Hours Hours to add to the sleep time.

2

Minutes Minutes to add to the sleep time.

3

Seconds Seconds to add to the sleep time.

4

Milliseconds Milliseconds to add to the sleep time.

5

Failonerror Flag controlling whether to break the build on an error.

Example

Usage

使用以下内容创建 build.xml −

Create build.xml with the following content −

<?xml version="1.0"?>
<project name="TutorialPoint" default="info">
   <target name="info">
      <sleep seconds="2"/>
   </target>
</project>

Output

在上述构建文件上运行 Ant 会生成以下输出:

Running Ant on the above build file produces the following output −

F:\tutorialspoint\ant>ant
Buildfile: F:\tutorialspoint\ant\build.xml

info:

BUILD SUCCESSFUL
Total time: 2 seconds