Java Reference
In-Depth Information
Viewing the Ant build targets
The default build target is shown in a bold font. It's specified in the Ant build file
through the
default
attribute of the project task. This target is executed if you
click the
Run
icon with no target selected or double-click the name of the build
file. The targets listed in a normal font are the primary targets. Any target in your
build file that has a
description
attribute specified is considered a primary target.
The targets in the lighter color text are the secondary targets. Typical Ant scripts
contain many targets that aren't meant to be called directly and are used like sub-
routines by the primary build targets. It's a good practice to specify a description
for all targets that can be called directly.
If your build targets have a value specified for the
<description>
at-
tribute, passing your mouse pointer over any such targets in the
Ant
Build
tool window displays the value of the description in the handy
form of a tool tip.
TIP
5.2.4
Executing Ant targets
From within
IDEA
, you can easily execute build targets, review the results of com-
pilation, and navigate directly to any errors encountered. You can even automat-
ically trigger the execution of Ant build targets upon
IDEA
events such as
compiling, launching, or debugging an application from within
IDEA
.
Running a build target
The most straightforward way to execute an Ant target is to double-click on it in
the
Ant Build
window or select it with the mouse and click the
Run
icon. Doing
so executes the target and displays the results in the
Messages
window, as we'll
discuss later. Right-clicking an Ant target and selecting the
Run Target
option
has the same effect.
An alternative way to execute Ant build targets is to select them from the main
Build
menu. Each Ant build file you've added to your project is added as a sub-
menu to the bottom of the
Build
menu's choices, with all the primary targets
listed as child selections. Selecting one of these target menu items is the same as
double-clicking the target from the
Ant Build
window.
Executing a target from a keyboard shortcut
It can also be handy to create a keyboard shortcut for an Ant target. Doing so
makes it easy to execute common build targets with a single key. The primary Ant
targets for each Ant file in your project are listed as actions in the
Keymap
control