On Fri, Aug 16, 2002 at 10:54:17AM -0400, Grinvald, Edward wrote: > Hello all, > I have a problem, which i hope you can help me solve: My project has > several subprojects, let's say a - z. Some of the subprojects depend > on other subprojects. Let's say a depends on b and c, c depends on d > and e, and e depends on f. Assum there are no circular dependencies > (i hope there aren't). Each subproject is in a separate directory, so > i can say build in a subdirectory, jar, put in 'lib', build in b > subdirectory, jar, put in 'lib', etc. I am trying to make it so that > the user can say he/she wants to build a, and it will go to a, read > dependencies on b and c (from a text file or something), go to build > b, see dependency on d and e, etc. I see no way to do this other > then recursion, but i'm having difficulties, because i don't fully > understand how recursion would work in ant - would the properties be > mixed up if i invoke the same target multiple times, etc.
In Avalon's Excalibur project, we had the same issue of building a large number of subprojects with many interdependencies. While waiting for a better solution (maven's reactor is quite nice), we're using a script that recursively builds projects, and checks to see if they're already built before rebuilding. All straight Ant 1.4. A subproject would use it as follows: <project name="Excalibur Fortress" default="main" basedir="."> ... <target name="dependencies" description="Check dependencies" unless="skip.dependencies"> <ant antfile="../depchecker.xml" target="checkCommon"/> <ant antfile="../depchecker.xml" target="checkFramework"/> <ant antfile="../depchecker.xml" target="checkLogkit"/> <ant antfile="../depchecker.xml" target="checkAltrmi"/> <ant antfile="../depchecker.xml" target="checkCollections"/> <ant antfile="../depchecker.xml" target="checkInstrument"/> <ant antfile="../depchecker.xml" target="checkInstrumentManager"/> <ant antfile="../depchecker.xml" target="checkSourceResolve"/> <ant antfile="../depchecker.xml" target="checkEvent"/> </target> <target name="compile" depends="dependencies" description="Compiles the source code"> ... </target> </project> In depchecker.xml, the checkXxx targets all reuse the same checkRequiredFile or checkRequiredClass targets. There is support for downloading missing dependencies, eg checkJUnit could fetch junit.jar from an online repository (see ibiblio.org/maven) It's a hack, but then everything in Ant is a hack when you get beyond a certain level of complexity ;) If you'd like to reuse this, checkout the jakarta-avalon-excalibur module. The dependency checking is all in depchecker.xml and quite reusable. --Jeff > Please help. > > Thank You, > > Edward Grinvald > Computer Associates International > Programmer, Storage Development > [EMAIL PROTECTED] > (631) 342 6350 > -- Hell is a state of mind. And every state of mind, left to itself, every shutting up of the creature within the dungeon of it's own mind -- is, in the end, Hell. C.S. Lewis, _The Great Divorce_ -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>