ant 中文手册--介绍

2008-02-23 09:43:29来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

Introduction

Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles.

Why?

Why another build tool when there is already make, gnumake, nmake, jam, and others? Because all those tools have limitations that Ant's original author couldn't live with when developing software across multiple platforms. Make-like tools are inherently shell-based: they evaluate a set of dependencies, then execute commands not unlike what you would issue on a shell. This means that you can easily extend these tools by using or writing any program for the OS that you are working on; however, this also means that you limit yourself to the OS, or at least the OS type, such as Unix, that you are working on.

Makefiles are inherently evil as well. Anybody who has worked on them for any time has run into the dreaded tab problem. "Is my command not executing because I have a space in front of my tab?!!" said the original author of Ant way too many times. Tools like Jam took care of this to a great degree, but still have yet another format to use and remember.

Ant is different. Instead of a model where it is extended with shell-based commands, Ant is extended using Java classes. Instead of writing shell commands, the configuration files are XML-based, calling out a target tree where various tasks get executed. Each task is run by an object that implements a particular Task interface.

Granted, this removes some of the expressive power that is inherent in being able to construct a shell command such as <NOBR>`find . -name foo -exec rm {}`</NOBR>, but it gives you the ability to be cross-platform - to work anywhere and everywhere. And hey, if you really need to execute a shell command, Ant has an <EXEC>task that allows different commands to be executed based on the OS it is executing on.

介绍

Apache Ant是一个基于java构建工具,在理论上讲, 他是编译的一种, 但是没有编译痕迹

现在的编译工具繁多, 如make, gnumake, nmake, jam,等等:为什么我们还要做一个ant来编译呢? 因为,其他的工具都存在一个局限性:不能跨越平台操作, 这也是ant作者所不能忍受的。

Ant 是一个基于javaclass文件扩展的编译工具, 不想很多编译工具, 是基于一个命令外壳程序, 取而代之, ant 是以一个xml配置文件, 写入一组目标树来执行编译过程的,每一个目标树是一个特别的任务接口,你可以在任何地方来使用这个工具, 他是真正跨平台的,如果你一定坚持要用命令行来执行编译过程,好, ant也有一个特殊的任务叫exec,可以在操作系统上执行不同的任务。


上一篇: Java常见面试题(含答案)
下一篇: 实现Java与C语言接口

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Jsp 连接 mySQL、Oracle 数据库备忘(Windows平台)

下一篇:20分钟熟悉猛虎脾气-JDK1.5新特性介绍