O'Reilly logo

Ant: The Definitive Guide by Jesse Tilly, Eric M. Burke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

AINASL: Ant Is Not a Scripting Language

After looking at the example project and buildfile, you may begin to look at Ant as a sort of scripting language for builds. With this bit of insight, you may charge forward writing buildfiles with this concept in mind...until the wheels fall off and you’re stuck wondering why Ant can’t do something you’d expect of any scripting language. Here’s why they fell off: XML does not make for a good scripting language.

In a way, you’re excused for seeing Ant as a sort of XML scripting language and accompanying parser. The difference is that, viewed as a scripting language, Ant is not very good. In fact, it’s horrible. This little oddity of perception can cause a lot of confusion and frustration. Viewing the build as a design and not as a series of steps helps alleviate this confusion. We champion this authoring technique. So where does Ant’s XML syntax fail as a scripting language?

Look Ma, No Data Structures!

A more concrete example of an oddity in Ant’s syntax is its management of data. Here, the closest analogy to a language variable is the <property> tag. This, of course, completely ignores the rich data capabilities of XML, and Ant’s developers know this. In addition to the property, there is the concept of an Ant data element — for example, the path DataType. The limitation is you cannot create DataTypes “in-language,” as you can with a scripting language. Instead, you must write a class (or a set of classes) to represent a new data type in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required