tags:

views:

19

answers:

2

I have a build with multiple interlinked dependencies, Several projects have common dependencies that are currently compiled more than once. I think in Ant we can tell it not to re-build something if its already just done it as part of the same task, can anyone please advise

+1  A: 

ant's javac task will only compile if the source files are newer than the target files. So that should save you some time.

You can also look into ivy for a bit more formal dependency management.

leonm
A: 

Like leonm says, the compiler will do the right thing. But that won't stop Ant from rebuilding loads of artifacts. What I'd suggest is:

  • where you can, make targets have a defined output. So a target that builds a jar file from sources can be skipped if those sources haven't been updated since the jar file was built.
  • how do you implement this? use the uptodate task to set a property if something is actually up to date.
  • I'd suggest that any targets that do checks be prefixed with a hyphen so they can't be run on their own
  • And finally, use the 'unless' attribute of the target element to prevent the target running.

Julian Simpson