Skip to Main Content
Eclipse Cookbook
book

Eclipse Cookbook

by Steve Holzner
June 2004
Beginner to intermediate content levelBeginner to intermediate
364 pages
7h 38m
English
O'Reilly Media, Inc.
Content preview from Eclipse Cookbook

7.3. Catching Ant Build File Syntax Problems

Problem

You have a problem with a build file, and you would like to track it down.

Solution

The current version of Ant displays syntax errors for Ant scripts only when you try to run them. However, Eclipse 3.0 does catch and display syntax errors as they’re created.

Tip

This is an Eclipse 3.0-only solution.

Discussion

Eclipse does offer some support for catching syntax errors when you write Ant scripts. However, the Eclipse editor catches syntax errors only if your XML documents are not well formed in the XML sense (e.g., nesting errors, omitting quotes for attribute values, etc.). You can see an example in Figure 7-7, where we’ve omitted the quote in front of the text jarFile, which is being assigned to an attribute in the <property> element.

An XML error in an Ant script

Figure 7-7. An XML error in an Ant script

Note, however, that although the Ant editor indicated that the XML was not well formed, it entirely missed the fact that the <property> element’s name attribute is misspelled as nane, as shown in the figure.

On the other hand, when you try to run this script, Ant will realize there’s a syntax error, and you’ll get the results you see in Figure 7-8, where the syntax error is indicated.

An Ant error

Figure 7-8. An Ant error

Eclipse will show you the syntax error when you try to run ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Eclipse

Eclipse

Steve Holzner
Official Eclipse 3.0 FAQs

Official Eclipse 3.0 FAQs

John Arthorne, Chris Laffra

Publisher Resources

Supplemental ContentCatalog PageErrata