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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

9.4 A Sample Ant Buildfile225$ antBuildfile: build.xmluseless:[echo] This example's usefulness: nil. OK?BUILD SUCCESSFULTotal time: 1 sec<strong>on</strong>d9.4.2.4 TasksA task is something that must be d<strong>on</strong>e to build the target. There is no single“task” tag; instead, each kind of task has its own tag 8 so there are many tagsreferred to collectively as task tags.There are dozens of standard task tags, but <strong>on</strong>ly a few of them are “everyday.”We’ll introduce a few of them here, and then talk about the tags thatd<strong>on</strong>’t fall into the project/target/task hierarchy.Standard task attributes.All ant task tags have at least the three attributes:idA unique ID for the task (not required).tasknameA name for the task, used in logging (not required).descripti<strong>on</strong>A descripti<strong>on</strong> of the task, used for comments.The javac task. The javac task, not surprisingly, runs the Java compiler.Note that since the Java compiler is written in Java and so is ant, there is noVM launch overhead to running the compiler. This can make ant many timesfaster than make simply for normal compiles.The javac tag is <strong>on</strong>e of the most complex in ant.The javac task tag has a very large number of attributes, and may c<strong>on</strong>tainquite a number of other tags within it. First off, it is sensitive to a property,build.compiler, which may be used to specify that a particular Java compilerversi<strong>on</strong> must be used. The use of this will come up later when we build part of8. In fact, task tag names corresp<strong>on</strong>d to the names of the Java classes that implement them.This will matter to you <strong>on</strong>ly if you wish to write your own ant tasks. We will not take you thatfar in this book.

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

Saved successfully!

Ooh no, something went wrong!