Miscellaneous Task Topics
Being something that changes every six months, Ant is by no means in
a perfect state. Some of its behaviors are not always immediately
obvious. There are quirks, open issues (read: bugs), and hidden
features not in the distributed documentation. The following sections
describe items you need to be aware of when writing your own tasks.
If you want to live dangerously, implement your task, deploy it, and
see what happens. When you have a problem you can’t
explain, jump back to this section and see if one of these items
help. Some issues, such as System.exit( )
, will
never go away unless the JVM specification changes. Other problems,
such as magic properties, may go away after some new task model
implementation finds its way to release in the future. Of course, you
can try to avoid all issues in the future by implementing a task
test.
Magic Properties
Many moons
ago, the javac
task came to be. Many people said
it was good and many others nodded in agreement. At the time, at
least three different compilers were available for the primary Java
platforms (Solaris, Linux, and Windows). These compilers were
javac
(and its different compile modes),
IBM’s jikes
, and
Symantec’s sj
. Rather than have
the compiler type defined as an attribute of the
<javac>
element, the developers decided that
there should be a global setting, affecting all uses of the
javac
task. This
global setting applies to every occurrence of
javac
or any related task that derives from the
Javac ...
Get Ant: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.