> From: Steve Peterson [mailto:[EMAIL PROTECTED]
> I'm having an issue with the destination directory for .class
> files in Ant
> builds. My goal is to have the .class file live in the same
> directory as
> the .java file.
>
> In my build.xml I say
>
> <javac
> srcdir="${src.java.dir}/com/databottling/fountain/core"
> destdir="${src.java.dir}/com/databottling/fountain/core"
> includes="Constants.java"
> debug="${debug}"
> />
>
> where <property name="src.java.dir" value="src"/>
>
> If there is a Constants.class in the destdir, javac will
> overwrite that
> with the newly created .class. If there isn't, javac creates a
> com/databottling/fountain/core/Constants.class inside
> destdir, which isn't
> what I want.
There is a simple solution,
use destdir="${src.java.dir}". This is the root of the
class/package tree.
You might want to use srcdir="${src.java.dir}" also. Ant
will scan for sourcefiles within that tree. You can narrow
the search using includes and excludes.
Your example should look like:
<javac
srcdir="${src.java.dir}"
destdir="${src.java.dir}"
includes="com/databottling/fountain/core/Constants.java"
debug="${debug}"
/>
See the manual for more information on the include/exclude stuff.
Cheers,
Arnout