Ant and the use of the full stop

I’m currently working on a project with a relatively large (~2000 line) Ant build file, with several supplemental files. The first thing that’s struck me, is that something about the nature of Ant itself makes people treat it very differently from the code it’s building. Rules concerning consistency, testing, maintainability and even common sense seem to go out the window. Whilst it’s true that Ant doesn’t go out of its way to help us – there is little tool support and the XML syntax is fundamentally unsuited to a program (which is really what an Ant file is) – if developers engaged their brain a little more, they’d make life a little easier for everybody.

I’m going to revisit some of the problems with Ant at a later date, but today I’d like to focus on one particular annoyance – the use of the full stop in naming of targets and properties.

As I see it, there are three ways to use a full stop. Firstly, as a space:


  ...

Secondly as a way of defining a build hierarchy:


  ...
  ...

And finally, seemingly at random:


  ...
  ...

The main build file I’m working with has examples of all three. Personally I can accept either of the first two approaches, but please be consistent. In fact, please use the same rigour in creating your build files as you do when coding!

This entry was posted on Wednesday, December 15th, 2004 at 1:52 pm and is filed under Java. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

8 Responses to “Ant and the use of the full stop”

2000? Hardcore! My biggest is a little over seven hundred lines – that that’s probably half comments.

I’m trying scons out now, but it’s Java support is leaving a little to be desired. I should probably start by tring to build something small, rather than our existing codebase with the 2000 line ant file :-)

(Whips out ruler) – our main build file is 2817 lines, including the very occasional comment. Plus we’ve got a few other build files for testing and cvsing.

You should (if possible) try to split this uge thing using subant, import… tasks

We have split some tasks out, but the very nature of spliting stuff out can lead to complexity. We need to rewrite the whole thing to be honest, but will do it bit by bit – we’ll create clean, new sub-ant files which we’ll make calls to, and let the rest of the file remain awful. Trying to clean up a 2000 ant file during active development in one fell swoop is a recipie for disaster

I like to use the period (you Brits can say ‘fullstop’ :-) for the hierarchy case. For the space case, I prefer hyphens. I avoid the last case.

I kind of like period for hierarchy with camel case for spaces, as this fits with most peoples Java style, and ant is mostly used to build Java after all. Really though, I’d just like things to be consistent :-)

Take a look at my blog entry on leafcutter, an API which I wrote to execute Ant tasks from Java code. I find this a better choice than Ant for complex build processes.

Have your say





Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:

URIs must be fully qualified (eg: http://www.domainname.com) and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.