7.10. Using Ant as an External Tool

Problem

You want to run Ant as an external tool.

Solution

Select Run External Tools External Tools, click Program, click New, and enter the required information to install Ant as an external tool. Then click Run to execute the build file.

Discussion

Eclipse can launch and run external tools as easily as internal ones. You can run Ant as an external tool if you want to: select Run External Tools External Tools, click Program, click New, and enter the name you want to give to the external version of Ant. As for the Location field, click Browse File System, and find the correct file for your operating system to run Ant (for example, that’s ant.bat in the Ant bin folder in Windows). In the Working Directory field enter the directory of your build file, and enter any arguments you want to pass to Ant in the Arguments directory. Then click Run to execute your build file and perform the build.

Tip

External tools now can be run in the background, by a separate thread. Just check the “Run tool in background” checkbox in the Run External Tools External Tools dialog. Doing so means that you can let an Ant build run or launch an external program and still continue to work in Eclipse.

See Also

Recipe 7.5 on using your own version of Ant.

Get Eclipse Cookbook 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.