It’s the whole problem that there are layers and layers of crap between you, and what you want to do, and every one of those layers can have bugs. In this case, the bug is in Jakarta Ant. The problem is that it took me two hours to figure out that it wasn’t something that I was doing, but that it was something in Ant, or the interaction with Ant and OSX’s Java, or… well, I don’t know where the problem is, and I don’t really care. Struggling to get something as fundamental as this working isn’t how I want to spend my time.
So, here’s the thing: you’d expect these two chunks of Ant script to do, essentially, the same thing. Yeah, the internals are different, but you’d hope they’d have the same high-level effect:
Right? I mean, nothing complex or tricky here. But they don’t. Ant completely fucks up the first one; the class path is not set correctly. At least, it doesn’t work with Ant 1.7.1 and Java 1.6.0 on OSX 10.6.4. Put these two lines in the same target, just like they are, and the first one prints out an entirely different classpath than the second (assuming that the class code prints the class path). The first one’s class path isn’t even remotely correct; a dump of the ClassLoader class path contains exactly one element, and that’s some ant jar file.
Seriously, I have better things to do with my time than waste it tracking down somebody else’s brain farts. It’s why I hate the Java VM, and more especially, things built on top of it – frameworks are especially bad, because they’re just chock full of other people bad code.