ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M.A.Dunphy" <>
Subject RE: When to compile or not to compile that is the question?
Date Fri, 09 Feb 2001 15:21:41 GMT
Call me a lazy bugger, but my current way of thinking is not to add
specifics (such as filenames) into the ant build file. Now to compile a
class which depends on another class being compiled, then the later must be
compiled first. Thus I've partitioned this dependancy to into targets and
the linked them via the depends attribute.

So we can say that B depends on A. To compile each target, I set the srcdir
to that specific directory, as illustrated below:

<target name="fw-compile-exceptions"
    <javac srcdir="${fw.src.dir}/exceptions" destdir="${fw.classes}"
<!-- =================================================================== -->
<!-- Prepares the framework config                                       -->
<!-- =================================================================== -->
<target name="fw-compile-config" depends="prepare">
    <javac srcdir="${fw.src.dir}/config" destdir="${fw.classes}"

This isolates what gets compiled, cause if I give a more general path as you
mentioned, everything is attempted to be compiled in an arbitrary fashion
which wont work?.

But as you say, this means that I wont get the partial builds but rather
complete builds. It seems to me I'm caught between 2 stones?

-----Original Message-----
From: Diane Holt []
Sent: 08 February 2001 09:01
Subject: Re: When to compile or not to compile that is the question?

--- "M.A.Dunphy" <> wrote:
> As I'm new to ant/java, could somebody help explain why when I run a
> task in ant, the .java files always get compiled even if they are not
> edited/changed since the last time the .class file was created?

It's most likely due to how you're pointing to where the source-files are
located. You need to specify "srcdir" as the directory path one directory
element -before- where the package hierarchy begins. For example, if your
directory structure is /workspace/main/com/foo/..., "srcdir" should point
to "/workspace/main". If you specifically include files, they should be
pointed to starting at "com" (eg., <include name="com/foo/"/>).



Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!

View raw message