ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Integrating Ant with Eclipse, Part 1
Pages: 1, 2, 3, 4

The other option to run a build file is to right-click build.xml in the Package Explorer and select Run→ Ant Build..., this time with an ellipsis (three dots). This opens the Ant launch configuration dialog you see in Figure 11-6. The Ant launch configuration is specific to the current project.



Figure X
Figure 11-6. Selecting an Ant target

By default, the Targets tab is selected in this dialog, showing a list of the targets in build.xml. The default target has been selected; you can click the Run button to run that target, or you can select other targets to run. If you leave the default target selected and click Run, you'll see the same results as before in the Console view.

You can set the execution order of targets, shown in the Target execution order box at the bottom of the page (the order in which you select the items is the order in which they will run). Ant will still run each target's dependencies, but you have to be careful in case your changes mess up the overall build order.

Selecting the Build File and Passing Arguments to Ant

You can get as much use out of Ant in Eclipse as you can from the command line. For example, to pass arguments to Ant, right-click build.xml in the Package Explorer and select Run→ Ant Build... to open the Ant launch configuration. Click the Main tab shown in Figure 11-7. In this page, you can set the build file you want to use, the base directory for the build, and you can pass arguments to Ant.

Figure X
Figure 11-7. Setting the build file and arguments to pass to Ant

TIP: The Capture output checkbox at the bottom of this dialog indicates whether you want to capture the Ant output to the Eclipse Console view, as we've been doing by default.


View catalog information for Ant: The Definitive Guide, Second Edition

Return to ONJava.com.




0