Niall Smart wrote: > > Hi, > > Lets say I have a build system laid out like this: > > top/ > build.xml > foo/ > a.java > b.java > bar/ > a.java > c.java > > Is it possible to compile foo/a.java and bar/c.java using one javac > target? The following target natually fails with a "duplicate class: > a" error. > > <javac> > <src path="foo"/> > <src path="bar"/> > <include name="a.java"/> > <include name="b.java"/> > </javac>
well, this is getting to be an FAQ, given that variations of this question have shown up about 3 times in the last 48 hours... personally, i'm getting kinda confused as to why people would need duplicate class files in the same build tree. Refactoring and XP tends to lean towards "OnceAndOnlyOnce", and i've reached the point of applying that at the file level as much as at the method level. If multiple packages need some of the same utilities, i refactor the utility stuff into its own build tree and have the other builds reference it either by a classpath ref or by copying a "dist" jar file into the classpath. certainly solves my current problem of 'which of these versions of this file is my "latest and greatest"', a question i was constantly asking myself as copies of my utility class sources were all over the place on my dev directory. So for the sake of discussion, why do you all have the situation where you've got files of the same name/package in multiple locations on your tree? why haven't you pruned them out so that a new user can surf down the tree w/ "explorer" and see exactly what's what and where? if you have two files that represent the same package/class, but do two different things, why haven't you used proper OOP techniques and refactored them into two independent classes implementing a specified interface (with perhaps an abstract class to derive from)? Joe -- ---------------------------------------------------------------------- Joseph Shelby mailto:[EMAIL PROTECTED] 5809 Chase Commons Ct. #201 http://www.io.com/~acroyear Burke, VA 22015 (703) 323-7121 | 247-7868 Software Engineer, ISX Corporation, Arlington, VA "The people of England will permit anything...except cruelty to horses and a rise in the price of beer." -- Return of the Musketteers (1989) ---------------------------------------------------------------------- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
