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

advertisement

AddThis Social Bookmark Button

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

Configuring the Ant Editor

You can reformat an Ant build file using the Format command (Ctrl-Shift-F) from the Ant editor's context menu or by selecting Edit→ Format. To configure how that formatting works, open the Ant preferences page with Window→ Preferences→ Ant→ Editor→ Formatter, as shown in Figure 11-10. Any changes you make will be reflected in the Preview box.



Figure 11-10
Figure 11-10. Configuring Ant formatting

Selecting Window→ Preferences→ Ant→ Editor lets you configure the build file editor by setting tab widths, margins, highlighting and more.

Adding New Ant Tasks and Types

You can add new Ant tasks and types (covered in detail in the next chapter) to Eclipse by using the Ant preferences page at Window→ Preferences→ Ant→ Runtime. These tasks and types will be available for build files without having to use the taskdef or typedef tasks, which are normally needed.

To add a new task, select the Tasks tab, shown in Figure 11-11, click the Add Task button, and navigate to the JAR file in which the new Ant task is located. To add a new type, click the Types tab and follow the same steps.

Figure 11-11
Figure 11-11. Adding Ant tasks

TIP: If you can't find the JAR files you need, add them to the Ant classpath first.

Alternatively, you can add additional classes defining tasks and types to the Ant classpath by clicking the Classpath tab.

Pages: 1, 2, 3

Next Pagearrow