ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject Re: Subdirectory problem/always recompiles
Date Sun, 20 Nov 2005 15:54:52 GMT
> > I've got a situation where the directory structure of the source code
> > doesn't exactly correspond to the package structure, and therefore the
> > javac task always recompiles.

They do in fact, albeit spread across directories, at least to me.
It's when the package name ( is not reflected
in the directory structure .../com/company/foo that there's a
mismatch. For example, in one project the sources were directly
in src/, instead of being in src/com/company/foo.

> > Here's my source directory hierarchy:
> >
> >  src/gadget/alpha/com/company/foo
> >  src/gadget/beta/com/company/foo
> >  src/gadget/gamma/com/company/foo
> >
> > here's the output class hierarchy:
> > classes/com/company/foo

> > And to make it more difficult, the files in the 3 subdirectories all
> > depend on each other.

You already realize that these different directories shouldn't have
recursive dependencies. Normally different source dirs should only
have non-recursive dependencies (i.e be a DAG).

> I stumbled on a solution that worked for me, using multiple path entries
> as attributes of the <javac> task.

> <javac srcdir="gadget/alpha:gadget/beta:gadget/gamma"
> destdir="../classes">

Matt's solution should have worked just the same. AFAIK, a path-like
srcdir and the different <src> nested elements are combined into the
final source dirs.

Now if you're up to the challenge, you should try to work with the
developer to untangle the dependency knot you've discovered. Having
separate source dirs implies independent components, or at least clean
dependencies (i.e. a <javac> per dir can compile the source with no
additional source dirs). --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message