posted 18 years ago
This is exactly the problem that I have been attempting to solve over the last few weeks. The problem with your solution is that you have unnecessary duplication - that is, if you find a mistake in build.xml, you must update the file for each project.
The optimal solution involves an independent expression of project dependencies. That is, you'd express that your project is a "jar" project - and therefore, requires the resources to "build" a jar, etc. These resources would be resolved by the dependency manager. The problem with that is there are no decent tools out there for expression of dependency. The best I've found is Ivy by Jayasoft, but that is quite inflexible in terms of the different types of dependencies - for example, I write DocBook articles that depend on the DocBook DTD and DocBook XSL for "building" (transforming into presentation formats). There are other problems with Ivy that have caused me to abandon it.
I keep all project dependencies in a SCM repository (Subversion). There are some great articles that answer the question "should I keep dependencies in SCM or on the file system?". I confidentally conclude the former (in fact, I don't see the point of using the file system for non-static content much anymore).
I believe that this problem should be solved in a manner that is as flawless as possible, otherwise, what's the point of bothering about it? I have concluded that the only reasonable way to solve this issue is to write a decent (emphasis: flexible) project dependency manager. This, of course, costs time. Until that time comes around, I've merely conceded to what you suggest yourself - cringing every time I have to use it.
Good luck whatever you choose.
Tony Morris
Java Q&A (FAQ, Trivia)