Java Reference
In-Depth Information
It begins to differ at this point. The ant source package comes with a shell
script, build.sh , that actually builds a minimal version of ant and then runs
ant to complete the install.
Make sure that the JAVA_HOME and ANT_HOME are set as you want them,
then execute build.sh install . Unless you have installed the optional tasks, 5
you will see several warnings about missing classes. You may safely ignore these.
As with the installation of other packages built from source, you will need
to have appropriate permissions for the target directories. This might mean
running the install as root, with all appropriate attention and dread.
9.4
A S AMPLE A NT B UILDFILE
Let's go over the basics of creating an Ant buildfile. We'll start with an intro-
duction to XML, and then move on to the specific tags Ant supports and how
you might use them to automate a build.
9.4.1
The buildfiles of ant , usually named build.xml , are written in Extensible
Markup Language, or XML. Some of the reasons for this are:
XML for the Uninitiated
• XML is hierarchical.
• XML is standardized.
• XML is widely used and familiar to many programmers.
• Java has many classes for reading, parsing, and using XML.
• XML-based representations of hierarchical data structures are easy to read
and parse for both humans and programs.
XML is a successor to SGML, Standard Generalized Markup Language,
which is a language for defining markup languages. A markup document may
be validated . A validated document is one that conforms to a structural specifi-
cation of the markup tags in the document. Such a specification may be made
using a Document Type Definition (DTD), which is a holdover from the way
SGML markup languages were specified, or using one of the newer specification
5. There is a horde of optional tasks. As the name suggests, they are optional. Include these if
you need them. This is the only mention they will receive.
Search WWH ::




Custom Search