Apache Ant Tasks 简明教程

Apache Ant Tasks - Environment Setup

Apache Ant 以 Apache 软件许可证分发,该许可证是开源计划认证的、成熟的开源许可证。

Apache Ant is distributed under the Apache Software License which is a fully-fledged open source license certified by the open source initiative.

最新版本的 Apache Ant, 包括了它的全源代码、类文件和文档,可以在 https://ant.apache.org 找到。

The latest Apache Ant version, including its full-source code, class files, and documentation can be found at https://ant.apache.org.

Installing Apache Ant

我们假设您已经下载并安装了 Java 开发工具包 (JDK)。如果没有,请按照 file:///C:/java/java_environment_setup.htm 的说明进行操作。

It is assumed that you have already downloaded and installed Java Development Kit (JDK) on your computer. If not, please follow the instructions available at file:///C:/java/java_environment_setup.htm

  1. Ensure that the JAVA_HOME environment variable is set to the folder, where your JDK is installed.

  2. Download the binaries from https://ant.apache.org

  3. Unzip the zip file to a convenient location c:\folder by using Winzip, winRAR, 7-zip or similar tools.

  4. Create a new environment variable called ANT_HOME that points to the Ant installation folder. In this case, it is c:\apache-ant-1.10.12-bin folder.

  5. Append the path to the Apache Ant batch file to the PATH environment variable. In our case, this would be the c:\apache-ant-1.10.12-bin\bin folder.

Verifying the Installation

在计算机中验证 Apache Ant 的安装是否成功,请在命令提示符中键入 ant。

To verify the successful installation of Apache Ant on your computer, type ant on your command prompt.

您应当看到以下输出结果:

You should see an output as given below −

C:\>ant -version
Apache Ant(TM) version 1.10.12 compiled on October 13 2021

如果您没有看到以上输出结果,请验证您是否已经正确地按照安装步骤操作。

If you do not see the above output, then please verify that you have followed the installation steps properly.

Installing Eclipse

本教程还涵盖了 Ant 和 Eclipse 集成开发环境 (IDE) 的集成。因此,如果您没有安装 Eclipse,请下载并安装 Eclipse。

This tutorial also covers integration of Ant with Eclipse integrated development environment (IDE). Hence, if you have not installed Eclipse, please download and install Eclipse.

Steps to install Eclipse

  1. Download the latest Eclipse binaries from www.eclipse.org

  2. Unzip the Eclipse binaries to a convenient location, say c:\folder.

  3. Run Eclipse from c:\eclipse\eclipse.exe.