7.2. Building an Eclipse Application Using Ant
Problem
You have an Ant build file, and you want to build your application.
Solution
Right-click the build file, click Run Ant, choose the Ant target(s) to execute, and click Run.
Discussion
You created a build.xml file for an Eclipse
project in the previous recipe; to run that file in the version of
Ant that comes with Eclipse, right-click
build.xml, and click Run Ant. Doing so displays
the AntProject build.xml dialog shown in Figure 7-4. You can see the Ant targets created there
with the default Build target already selected.
You can select targets to run independently, but in this case just
leave Build selected, and click Run to execute all
the targets in the build file and build the project.
Tip
You also can start an Ant build by highlighting the project in the Package Explorer and selecting Run→ External Tools→ Run As→ Ant Build. If you want to select the targets to run, you also can select Run→ External Tools→ External Tools→ Targets, select the targets you want to run, and click Run.

Figure 7-4. Running Ant
The results appear in Eclipse in Figure 7-5. Note
the message we made Ant echo to the Console view here,
Ant
is
building
your
project., followed by the message
BUILD
SUCCESSFUL.

Figure 7-5. A successful Ant build
Here’s the text that appears ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access