13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

220Chapter 9Ant: An Introducti<strong>on</strong>It begins to differ at this point. The ant source package comes with a shellscript, build.sh, that actually builds a minimal versi<strong>on</strong> of ant and then runsant 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 opti<strong>on</strong>al tasks, 5you will see several warnings about missing classes. You may safely ignore these.As with the installati<strong>on</strong> of other packages built from source, you will needto have appropriate permissi<strong>on</strong>s for the target directories. This might meanrunning the install as root, with all appropriate attenti<strong>on</strong> and dread.9.4A SAMPLE ANT BUILDFILELet’s go over the basics of creating an Ant buildfile. We’ll start with an introducti<strong>on</strong>to XML, and then move <strong>on</strong> to the specific tags Ant supports and howyou might use them to automate a build.9.4.1 XML for the UninitiatedThe buildfiles of ant, usually named build.xml, are written in ExtensibleMarkup Language, or XML. Some of the reas<strong>on</strong>s for this are:• 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 representati<strong>on</strong>s of hierarchical data structures are easy to readand 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 maybe validated. A validated document is <strong>on</strong>e that c<strong>on</strong>forms to a structural specificati<strong>on</strong>of the markup tags in the document. Such a specificati<strong>on</strong> may be madeusing a Document Type Definiti<strong>on</strong> (DTD), which is a holdover from the waySGML markup languages were specified, or using <strong>on</strong>e of the newer specificati<strong>on</strong>5. There is a horde of opti<strong>on</strong>al tasks. As the name suggests, they are opti<strong>on</strong>al. Include these ifyou need them. This is the <strong>on</strong>ly menti<strong>on</strong> they will receive.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!