my dog learned polymorphism*
The moose likes Other Open Source Projects and the fly likes *NEWBIE* Ant compile attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "*NEWBIE* Ant compile attribute" Watch "*NEWBIE* Ant compile attribute" New topic

*NEWBIE* Ant compile attribute

Ronnie Phelps
Ranch Hand

Joined: Mar 12, 2001
Posts: 329
From what I understand, when ANT is compiling source files, it should skip source files that have been previously compiled and wasn't changed since. But for some reason it doesn't appear to be doing that for me. Is there some attribute I have to set to trigger this behavior?
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
It should be doing it automatically. It checks to see which is older, the .java file or the .class. If the .class is older, then it compiles. If you are saving your .java files without changes it will still treat it as if it has been changed.

Matthew Phillips
Ronnie Phelps
Ranch Hand

Joined: Mar 12, 2001
Posts: 329
Okay I just wanted to make sure. Maybe I'm just not noticing the time difference.
Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
Verify that the script's not deleting and then making the directory in which you've stored your class files, too. . . Makes for long compile/test cycles, otherwise.
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
I believe you need to invoke the <tstamp/> task, probably in your init target if you have one. This will set several properties based on the current system time. The javac task uses these properties to determine whether a source file is out-of-date and needs to be rebuilt.

kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
I agree. Here's the link:
subject: *NEWBIE* Ant compile attribute
Similar Threads
compiling and deploying EJB with ant
Eclipse remote debugging: Unable to install a breakpoint error
Ant 1.7 compilation problem with Java 5 Features
Creating a war using ANT
Ant and other Languages