ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: How to force Ant to perform all targets even when not necessary?
Date Mon, 26 Jan 2009 07:07:18 GMT
>> One of the features of Ant is to only process (dependent) 
>targets if it is necessary.
>> Otherwise the existing products are used for subsequent steps.
>It depends by what you mean by "dependent" targets.
>If we consider target A which depends on B and C, both of which depend
>on D, Ant will notice that D needs to be run only once, so the targets
>executed with be [D, B, C, A] in that order (using the default
>executor). If your intent is to have [D, B, D, C, A] executed, Ant
>doesn't support this out of the box. You could write your own
>executor, an Ant extension point which allows you more control over
>how/when targets are executed, but you'll have to write Java code and
>specify the classname of the executor on the Ant command line.
>If you the other hand you meant to force the *tasks* inside the
>targets to force "executing", as in foregoing their usual dependency
>analysis to avoid doing unnecessary work, there's no standard way to
>achieve that either. Some tasks have an attribute to force processing,
>others don't. But generally, a best practice is to put all build
>artifacts into a single build/ directory, and having a clean target
>that deletes this directory; calling the clean target first implicitly
>means all tasks will see missing "target" files, which is in effect an
>implicit "force".
>I'm not sure that's what you meant though. --DD

Maybe there is also a confusion. Are you shure that the "targets" are
not executed or are the "tasks" not executed? E.g.
<target name="compile">
  <javac .../>
<target name="build" depends="compile"/>
$ant build
$ant build   (a 2nd time)

On the second time the 'compile' target will be executed while 'javac'
wont do anything because there are no newer source files.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message