Apache Ant Operation Manual
introduction
Apache Ant is a Java-based compilation tool. It is functionally similar to Make, but it overcomes the shortcomings of Make.
Why do you have an ANT after Make, Gnumake, NMAKE, JAM? Because these compilation tools have certain limits. The initial developers of Ant developed the previous development tools in developing cross-platform applications. For example, a Make tool, it is based on shell, it judges a series of conditions, and performs compilation commands as follows, which is good: for specific platforms (such as UNIX), which can be easily compiled with these tools. But at the same time, this also means that your compilation is limited to the fixed operating system, as can be used only for UNIX.
At the same time, Make files also have some innate defects. Many people will encounter terror Tab issues. Ant's initial developers have repeatedly said "My command can't be executed because I added a space in front of Tab!" Some tools solve this problem such as JAM, but still have other format issues.
Ant is different from those tools that are expanded from commands, and Ant is extended by Java class. No need to write the shell command, but configure the XML-based file to form a target configuration tree for multiple tasks. Each task is running through a Java class that implements a specified interface.
Ant lacks the ability to directly execute the shell command, such as Find. -Name Foo -exec RM {}, but it provides users with cross-platform capabilities, you can work anywhere. In fact, Ant also provides command execute to execute shell commands, which is its
Install ANT
Download Ant. Ant has two versions, binary versions and original code versions.
To compile and use Ant, you have to have a XML parser that is compatible with JAXP.
Binary versions have the latest Apache Xerces2 XML parser. If you want to use different compatible jaxp parsers, you can remove two files in XerceptImpl.jar and XML-Apis.jar under the ANT library. You can use the parser to put it in the ANT library directory, or put the JARS file into the system's classpath.
In the current version of Ant, you also need to install JDK. The following two-in-film versions are installed after installation.
ANT installation directory
Ant / bin contains run scripts
Ant / lib ANT runs the class library required
Ant / DOCS documentation
Ant / etc Some configurations, how to establish a detailed report through the XML output of the task, move the compiled file, ignore the error warning
Do some settings before running:
1) Add an Ant / bin directory in the Path path;
2) Set ANT_HOME to the installation directory;
3) The java_home is the Java installation path.
For example, below:
SET ANT_HOME = C: / Ant
SET JAVA_HOME = C: /JDK1.2.2
SET PATH =% PATH%;% Ant_Home% / BIN