7.4. Using a Different Build File

Problem

You want to build your project using an XML build file not named build.xml.

Solution

Just select Window Preferences Ant and enter the name(s) of your build file(s). Then click OK.

Discussion

If you need to change the name of your build file from build.xml to something else, select Window Preferences Ant, opening the Ant Preferences page shown in Figure 7-10. Just enter the name of your build file, and click OK. If you want to list multiple names, separate them with commas (use only one of these build files per project, or else Eclipse will be confused, and you’ll get an error). Note that this is a global change, so if you change the build filename here, it’ll be changed for all projects.

Setting the build filename

Figure 7-10. Setting the build filename

Tip

You also can specify the location of a build file. Right-click build.xml, click Run Ant, and click the Main tab in the dialog that opens. You can set the location of the build file you want to use in this dialog, as well as the base directory for the build.

Note that you also can configure Ant a little in the Window Preferences Ant dialog, but not much. This dialog allows you to select only the colors of Ant messages in the Console view, which isn’t very impressive. More Ant configuration options are available by selecting the nodes under the Ant item; see the following few recipes for more details.

Eclipse 3.0

Eclipse ...

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.