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.

228Chapter 9Ant: An Introducti<strong>on</strong>The rmic task. Remote Method Invocati<strong>on</strong> is a distributed computingtechnology (Secti<strong>on</strong> 5.8). RMI requires the generati<strong>on</strong> of server and stub classesthat provide the networking support for an RMI-enabled class. This is normallyd<strong>on</strong>e by the rmic compiler, and this is <strong>on</strong>e of the comm<strong>on</strong> reas<strong>on</strong>s the Javaprogrammers turn to build automati<strong>on</strong> tools. The rmic tag allows ant to buildRMI classes.9.4.2.5 Other TagsSo far we have ignored a major comp<strong>on</strong>ent of ant. In order to introduce it, weneed to give you a (painfully) high-level view of how ant works “underthe hood.”Task tags actually map directly to Java classes that implement the tasks.Each task class is an instance of the Task class (in other words, it is a Java classthat either directly or indirectly extends the Task class). This is how you canwrite your own tasks—download the ant source code and write your classesthat extend the Task class.Tasks are not, however, the <strong>on</strong>ly tags that map to Java classes. There isanother category of tags that do so. They are called datatypes. These are classesthat directly or indirectly extend the ant DataType class.Generally speaking, a task may require zero to many datatypes to specifythe data with which the task works. Some such tags include the manifest tagused in our sample build.xml file discussed later in this chapter.We’ll menti<strong>on</strong> a couple of the most frequently used datatype tags here andleave looking up the details as an exercise for you.The PatternSet, Include, and Exclude datatypes. As you may havenoticed, the most comm<strong>on</strong> tags we have covered allow you to specify the filesto be processed using the tag’s attributes. Usually, you nominate a base directoryand let the task tag process everything in that directory.There are times, however, when you need finer grained c<strong>on</strong>trol than that.For example, you might wish to exclude all Java classes whose names end in“Test” (Example 9.3).Other datatypes. There are many other datatypes used for various purposes.One of them, FilterSet, is able to modify files before they are copied ormoved. This can be useful, for example, to put build informati<strong>on</strong> into a sourcefile for an About dialog.

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

Saved successfully!

Ooh no, something went wrong!