import-bot (20211) [Avatar] Offline
[Originally posted by bobc]


Using: Java 2 SDK 1.4.2 beta from
ant 1.5.3 from
Red Hat Linux 9 with all updates applied

I extracted all the antbook/Sections/Learning/ch02/* files from the file which I downloaded from the web page. I
didn't extract the entire contents of the zip file, just the chapter 2 files.

Then I cd'ed into antbook/Sections/Learning/ch02 and executed ant as
instructed on page 26 of the book.

The result is that ant compiled 2 Java files: firstbuild/ and

Section 2.4 of the book explicitly indicates only one java file is built. But
you also say that ant looks in the current directory and all subdirectories
for source code; therefore it looked in both the firstbuild and secondbuild
directories, and found 2 source files rather than 1.

This is probably not what you intended, which leads to my next point.

Book Section 2.5 begins discussing imposing structure to the build, and that,
no doubt, is what the secondbuild directory is meant for. Will the apparent
error mentioned here cause a problem when working with the build file in the
secondbuild directory?

You may want to re-do your source code zip file?


Bob Cochran
Greenbelt, Maryland, USA
import-bot (20211) [Avatar] Offline
Re: Chapter 2 Source Code -- build.xml Question
[Originally posted by steve_l]

Thanks Bob, for this pointer.

The secondbuild task should not care about what the firstbuild task does,
because they build to separate places.

More at risk is the firstbuild task: if there are two classes, both
in the 'default' package, then whichever one gets compiled last becomes the
one whose .class file gets executed.

So it could be down to luck whether firstbuild runs as intended or not.