praveen
praveen

Reputation: 81

ant build issues

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

Upvotes: 0

Views: 95

Answers (2)

Julian Simpson
Julian Simpson

Reputation: 617

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.

Upvotes: 0

leonm
leonm

Reputation: 6484

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.

Upvotes: 1

Related Questions