A P P E N D I X B
Appendix
B
16. Appendix
B
Introducation to ANT Build System
Before the days of ANT therefore was only make available to build your application with
dependencies to avoid recompilation every time you needed a new build. But make is hard
to write and maintain, is most of the time platform dependent and does not perform well in
Java because make calls the Java compiler for each file instead all at once.
So on a flight David Duncanson (father of Tomcat) was tired of all this hassle and decided to
write a Java based build tool to ease the development of Tomcat. As soon as Tomcat was put
on the CVS repository of
http://jakarta.apache.org
ANT became a success maybe
even more than Tomcat.
ANT (
http://jakarta.apache.org/ant
) is a pure Java build system taking one or
several XML files as input telling ANT what and how to build your application. This build
file (by default named build.xml ) contains three parts:
Definition of properties which can (if setup) be overwritten by another file
List of build in tasks to compile, jar, copy etc.
List of targets and the dependencies to none, one or more other targets
ANT starts with the specified or the main target (if not specified) and creates graph of the
dependent targets (directly or indirectly dependent of the specified target). Then the targets
are executed in reverse order (from the farthes away to the specified target). Finally each
dependent target is executed once and only once.
Normally it is the best practice to adjust a build file instead of writing your own. But in
order to write a build file from scratch create the project (root element) first, then the main
target, define its dependencies, create these targets and repeat the last two steps as
necessary. Try to avoid static text (paths, values, etc.) and use ANT properties instead.
These properties can be changed on a central place (where they are defined) and can be
overwritten from a properties file (if enabled in the build file). This properties file enables
clients to change settings without changing files in a CVS repository etc.
Page 133 of 140
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved