DekGenius.com
Previous Section  < Day Day Up >  Next Section

Recipe 7.4 Using a Different Build File

7.4.1 Problem

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

7.4.2 Solution

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

7.4.3 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.

Figure 7-10. Setting the build filename
figs/ecb_0710.gif


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.

7.4.3.1 Eclipse 3.0

Eclipse 3.0 adds a little to the Window Preferences Ant dialog, which enables you to handle some additional warnings and errors, such as when the Ant classpath doesn't include tools.jar, as shown in Figure 7-11.

Figure 7-11. The Window Preferences Ant dialog in Eclipse 3.0
figs/ecb_0711.gif


7.4.4 See Also

Recipe 7.5 on using your own version of Ant and on setting Ant's classpath; Chapter 5 of Eclipse (O'Reilly).

    Previous Section  < Day Day Up >  Next Section