On Mon, Jun 23, 2008 at 2:25 PM, Roman Kennke <[EMAIL PROTECTED]> wrote: >> The only way to do this is by resetting srcdir to an empty string. >> That's the technique <compilewithwalls> and others (including me) have >> used in the past. >> >> That way, Javac will compile *only* the file explicitly given to it, >> and never implicitly compile files the explicitly given classes depend >> on (which will lead to compile failures if the depend classes aren't >> found via the classpath). >> >> AFAIK, <javac> will accept several nested <fileset>s, so that's how >> you include source files from several directories (but remember to >> scrdir=""). --DD > > Yeah, I suppose this would work. But it would have the disadvantage that > the javac task could not map the sources to the .class files, and would > recompile everything on each invocation. Correct me if I'm wrong.
I think it may be... (note the "may" here). I don't have time to double-check, but I believe <javac> checks against the destdir to find out is a .java is up-to-date, not the srcdir. (And when I say <javac>, I mean Ant's wrapper around Sun's Javac compiler, since Javac itself do not do that). Thinking about it, it has to be that way, because I used this technique for a large project that was doing incremental compiles. > However, I think I found a better solution that works for me. Instead of > compiling it in one go, I compile it in 2 steps, and in the 1st step I > set the -sourcepath to the other sources dir, so that javac pulls in the > required sources from the other project. Then in the second step, I set > the classpath to the directory into which the 1st step built its > classes, so that it picks up the correct dependencies again. In both > steps I can set the necessary includes/excludes. Whatever works for you ;-) --DD --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
