ant 中文手册--介绍

王朝java/jsp·作者佚名  2006-12-17
窄屏简体版  字體: |||超大  

ant 中文手册--介绍

ant 中文手册--介绍 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,可以在操作系统上执行不同的任务。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航