You should have a look at the optional task "depend". It does exatcly what
you want.
Just call it before "javac".
<target name="src" depends="prepare"
description="Compile all updated source files with dependencies.">
<depend closure="yes"
cache="${dep}"
srcdir="${src}"
destdir="${build}"
/>
<javac verbose="false"
srcdir="${src}"
destdir="${build}"
classpath="${classpath.compile}"
/>
</target>
Cheers
Sylvain
> From: D Gross [mailto:[EMAIL PROTECTED]]
>
> I'm new to ANT and old to make. I would like to understand how to add
> dependency rules to ant to handle the simple case of cross class
> dependencies.
> I've read posts regarding <taskdef name="depend"...> and the
> depend="true"
> in the <javac> task, but either I'm not understanding it or it doesn't
> work. (At least I know the former is true)
>
> Here's the example:
> Class A has method foo() in A.java
> Class B calls A.foo() in B.java
> A.foo() is changed to take, say an int: foo(int x)
>
> When rebuilding with ANT, A.java will get recompiled, but not B.java.
>
> I've looked at jikes which will spit out the dependency information that
> would solve this problem, if I could just get the information into ANT
> so that it passes both A.java and B.java to javac.
>
> Thanks,
> -- Dave Gross
>
>
> __________________________________________________
> FREE voicemail, email, and fax...all in one place.
> Sign Up Now! http://www.onebox.com