ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Any examples of how we can simplify ant build.xml with templa tes (?)
Date Wed, 04 Feb 2004 15:50:43 GMT
> From: []
> > Whoa, that's a powerful trick Jan!
> Thanks. I developed that when I started building my buildfile-snippet
> library (time of XML-includes). And sometimes I needed the opportunity to
> do
> some work before and after the "template". So I modified <ant> to handle
> non-existing targets and suggested that on [1]. But the discussion there
> and
> on [2] and [3] had shown me some risky things and I had rewritten that as
> a
> <script>. Because my love to pattern I wrote one :-)

You have to be aware of course that calling performTasks *ignores* the
dependent targets of the target called. This may be surprising to you or
other people using this technique.

You might want to execute the target using Project.executeTarget instead
which will run the dependent targets, although this may also have
undesired consequences, 'cause the dependency analysis is done for each
target in turn, so if both your pre and post hook targets depend on the
target, that target will probably get executed twice... Again surprising.

Maybe the solution is just to check if the hook'd targets have dependencies
and fail if they do. That's what I'll do if I ever use your trick ;-) --DD

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

View raw message