You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ralph Spaulding <ra...@sftw.com> on 2000/09/12 21:10:14 UTC

Using ANT

Hi there.  I'm a new user,and I'm having some problems.

I tried using the ANT FAQ but the link seems to be broken on the Apache web site.
I could not find an archive of this mailing list anywhere, so I guess I'll just have to post.

I did also browse the code a bit, and it looks like this is a valid problem...

My problem is that ant always builds all my code, every time.
I have destdir set to the the top of my package hierarchy so that when javac runs it puts the class files in the proper directories.  That seems to work fine.  The problem is that when ant builds the list of source files to compile it does not search the lower level directories to see if it can find the class files there.  It only looks directly in destdir for the classes.  This is obviously not quite the desired behavior.

How have people worked around this problem?

I'd like it to just recompile the java files that are newer than the class files :-(.

Thanks,
Ralph Spaulding
ralph_spaulding@sftw.com


Re: Using ANT

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "VK" == Vasanth Kumar <s_...@yahoo.com> writes:

 VK> However, I can't see an answer to this in the FAQ yet.

The problem with the "not released yet" state. We'll have to wait for
the FAQ maintainer to approve it.

 VK> Can someone perhaps provide an answer to this issue?

This is what you'd find in the FAQ:

In order to find out which classes to compile Ant compares the timestamp
of the source file to the one of the corresponding class file.

For performance reasons Ant won't look into each file to read the package
declaration but deduces the package from the filename. I.e. if your source
file is src/a/b/C.java and srdir points to src, Ant will assume the class
to live in the a.b package.

To make this work, your classes must reside in a directory structure
matching your package structure and javac's srcdir attribute must
point to it. This is a requirement other tools have as well (javadoc
for example).

Stefan

Re: Using ANT

Posted by Vasanth Kumar <s_...@yahoo.com>.
Hi,

I am having the same issue (ant builds all my code, every time).  However, I
can't see an answer to this in the FAQ yet.

Can someone perhaps provide an answer to this issue?

Thanks


----- Original Message -----
From: "Stefan Bodewig" <bo...@bost.de>
To: <an...@jakarta.apache.org>
Sent: Monday, September 18, 2000 12:01 PM
Subject: Re: Using ANT


> >>>>> "PCB" == Peter C Brown <pb...@cs.umass.edu> writes:
>
>  PCB> On Tue, 12 Sep 2000, Ralph Spaulding wrote:
>
>  >> My problem is that ant always builds all my code, every time.
>
>  PCB> this definitely qualifies for the faq
>
> I've added an entry to the FAQ. As soon as it has left the "Not
> released yet" state it will be available to the public.
>
> Stefan


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Re: Using ANT

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "PCB" == Peter C Brown <pb...@cs.umass.edu> writes:

 PCB> On Tue, 12 Sep 2000, Ralph Spaulding wrote:

 >> My problem is that ant always builds all my code, every time.

 PCB> this definitely qualifies for the faq

I've added an entry to the FAQ. As soon as it has left the "Not
released yet" state it will be available to the public.

Stefan

Re: Using ANT

Posted by "Peter C. Brown" <pb...@cs.umass.edu>.
On Tue, 12 Sep 2000, Ralph Spaulding wrote:

> Hi there.  I'm a new user,and I'm having some problems.
> 
> I tried using the ANT FAQ but the link seems to be broken on the Apache web site.
> I could not find an archive of this mailing list anywhere, so I guess I'll just have to post.
> 
> I did also browse the code a bit, and it looks like this is a valid problem...
> 
> My problem is that ant always builds all my code, every time. I have
> destdir set to the the top of my package hierarchy so that when javac
> runs it puts the class files in the proper directories.  That seems to
> work fine.  The problem is that when ant builds the list of source
> files to compile it does not search the lower level directories to see
> if it can find the class files there.  It only looks directly in
> destdir for the classes.  This is obviously not quite the desired
> behavior.
> 
> How have people worked around this problem?
> 
> I'd like it to just recompile the java files that are newer than the class files :-(.
> 
> Thanks,
> Ralph Spaulding
> ralph_spaulding@sftw.com

this definitely qualifies for the faq...too bad the link is kaput...the
standard answer (which worked for me) is to make sure that your source
tree matches your package structure, and that srcdir points to the top of
your source tree, e.g., x.y.MyClass should be in mysrc/x/y/MyClass.java
and srcdir should be mysrc

hope that helps,

PB>>
_____________________________________________________
 Peter Brown                  Senior Staff Programmer
 Dept. of Computer Science        140 Governors Drive
 University of Massachusetts   Amherst, MA 01003-4610
 Phone: (413) 577-2505            Fax: (413) 545-1249
 pbrown@cs.umass.edu  http://www.cs.umass.edu/~pbrown
-----------------------------------------------------