A primary use of Ant is in the compilation of Java source files. <javac> is the task that gives you the power to do so. It runs the Java compiler on a set of Java source files within a specified directory (including subdirectories). The <javac> task works similarly to the javac executable in that it will compile only .java files that have no corresponding class file, and classes that are older than the corresponding Java file.

Note that because the source is not scanned, a class named fooBar in a file not named fooBar.java will always be compiled.

Table 4.44 lists the <javac> attributes, which include attributes that support all the options that you can pass to javac normally.

Table 4.44. Table of <javac> Attributes
Attributes Description ...

Get Ant Developer’s Handbook 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.