ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dale G. Herrig" <>
Subject Re: proposed fix, java files always compile
Date Wed, 09 May 2001 00:16:31 GMT
Nico Seessle wrote:

> ----- Original Message -----
> From: "Dale G. Herrig" <>
> To: "Ant" <>
> Sent: Tuesday, May 08, 2001 7:47 PM
> Subject: proposed fix, java files always compile
> >
> > Using:
> > Platform: Solaris
> > JDK1.3
> >
> >
> > No matter what I do, even after reading the FAQ solution
> > and making sure
> >
> > <!--#######[ time stamp target ]#######-->
> >   <target name="prepare"> <tstamp/> </target>
> >
> That should not change anything of the behaviour of the javac task since it
> normally does (or should do) the same thing you are doing, compare the
> timestamp of source and destination file.
> > and after trying many, many combinations settings of
> > srcdir= , destdir= and classpath=, when running ant
> > it always recompiles  my java files.
> >
> Maybe you should tell us (or should have asked a long time ago):
> - How does your target containing javac look like
> - How does your build environment look like (What directories, where are the
> sources, where are the classes)
> Can you try if the attached test works as expected? (Should compile 3, then
> 1, then 2 files).
> Can you provide a simple testcase which shows your problem?
> Maybe you are just including parts of the package name in the
> srcdir-attribute? This is a common mistake which leads to this behaviour.
> If I remember correctly there are other users using Ant on Solaris without
> problems like this... (Anyone here?)
> Nico

Thanks for replying. I have included a  mytest.jar file
that causes the compile "all the time." problem.

First, it's important
to know that I have some requirements  that maybe  Ant
doesn't support, here they are:

#1.   The classes must compile to the same directory
        as the java src files.

#2.   The build.xml "must reside" in the "same directory"
         as the java src files.

Here's how to do the test as I did it, you will need to
change the  directory name "/home/dgh1/the_ant_test"
to where you install.

> cd /home/dgh1/the_ant_test
>  jar -xvf mytest.jar

This will create  a subdirectory:

> cd de/seessle/p1

This has the "build.xml" as in above requirement #2
If you look at  build.xml you will see that I set up
"destdir" with the same as "classpath". This forces the
class files to be put in this directory as per requirement #1.

Now everytime you do:

> ant

It will always compile the files.

There is one more requirement, that is,  files
should only recompile if:

a.)  The java src is newer than the corresponding class
b.)  The corresponding class for the  java src is not there.

Again, I real appreciate your help and hope there is
a easy way to config the build.xml  to meet the above
requirements, without using my patch to the file.

>   ------------------------------------------------------------------------
>                Name: test.jar
>    test.jar    Type: Java Archive (application/java-archive)
>            Encoding: base64

View raw message