Ant Best Practices: Prefer a single buildfile

This is the third post in my series about Eric M Burke's Top 15 Ant Best Practices from December 2003. Today's practice is "Prefer a single buildfile". To paraphrase Eric, it's easier to understand a single file rather than a clever hierarchy of files. Having presided over several multi-file builds, I'm only too aware that you can easily hang yourself. On the other hand, sometimes it makes sense to extract something to a different file to achieve a separation of concerns.

If you are trying to map complex dependencies across many build files, or do amazing things in Ant or Nant, then perhaps you need to try and simplify things in your project. I once worked on a project where the frontend was written by my team, and the backend by other. The frontend team branched the work of the backend team, and the backend team kept on trucking with their work. I came to the belated conclusion that we had fallen prey to Conway's Law; really we had one project, and we should have written it like that. The build on that project was a nightmare: two projects pretending they were free agents, but in reality hopelessly dependent on each other.

I'm torn on this practice, but I'm going to agree with Eric. Ideally you shouldn't need multiple files. Though it does keep me in a job.

DevOps New Zealand