ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nico Seessle" <n...@seessle.de>
Subject Re: javac taskdef recompiling up-to-date classes
Date Wed, 14 Feb 2001 10:44:09 GMT
----- Original Message -----
From: "Vaughn Dickson" <vaughn@obsidian.co.za>
To: <ant-user@jakarta.apache.org>
Sent: Wednesday, February 14, 2001 10:59 AM
Subject: javac taskdef recompiling up-to-date classes


> I'm using the javac taskdef to compile my project source, the target looks
like
> this:
>      <javac
>             srcdir="${src.dir}/${app.name}:${build.xmlc_source.dir}"
>             destdir="${build.classes}"
>             classpathref="build.classpath"
>             includes="**/*.java"
>         />
>

This seems to be the typical "YGWYTATDNWYW"-Feature (You get what you tell
ant, not what you want)

Although you have not told us what the contents of src.dir and app.name are
I will try to guess your problem....

If app.name contains the package you are using for your classes you should
instead do

      <javac
             srcdir="${build.xmlc_source.dir}"
             destdir="${build.classes}"
             classpathref="build.classpath"
             includes="**/*.java"
         />
      <javac
             srcdir="${src.dir}/:${build.xmlc_source.dir}"
             destdir="${build.classes}"
             classpathref="build.classpath"
             includes="${app.name}/**/*.java"
         />

If you have a sourcefile com.company.mylib.sub1.MyClass.java in "src" and
wish to compile to "classes" the following happens if you specify

<javac srcdir="src/com/company/mylib" destdir="classes"
includes="**/*.java"/>

1. javac-task will find all your sources correctly
2. javac-task will strip basedir and srcdir from the absolute filename of
each sourcefile and tries to find a file classes/sub1/MyClass.class. Since
there is not and will never be such a file recompilation happens every time
you call this.

If you specify

<javac srcdir="src" destdir="classes"
includes="com/company/mylib/**/*.java"/>

1. javac-task will find all your sources correctly
2. javac-task will strip basedir and srcdir from the absolute filename of
each sourcefile and tries to find a file
classes/com/company/mylib/sub1/MyClass.class. This file exists and may be
the same date than your sourcefile. Recompilation will not happen -> You get
what you want.

Nico





Mime
View raw message