ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prashant Reddy <>
Subject Re: Fail build when 'replace' task cannot find expected number of tokens
Date Thu, 21 Feb 2008 13:37:25 GMT
I solved this problem like this, on advice of another colleague.

 * <record> the output of the <replace> tasks
 * Look for occurrences of the string "Replaced 0 occurrences" in the
recorded output
 * If above said pattern occurs fail the build.

Of course this approach still does not cover usecase when you are
expecting to find 3 replacements but only found 2.

I guess modifying <replace> task itself, (since it obviously knows the
number of occurrences) to take expected number of occurrences would have
been a clean soln.


On Tue, 2008-02-05 at 17:36 +0530, Prashant Reddy wrote:
> Hello ANT users,
> Using ANT 1.6.5, a build XML i am using makes use of <replace> task to
> replace certain token in a bunch of Javascript files.
> I would like the build to fail when the replace of a token fails, so
> that when someone changes the source file such that <replace> does not
> find any tokens to replace; the incident is caught straight away.
> Right now replace only supports printing of summary containing number of
> tokens that were replaced, but this is not good enough for me.
> Humm...Sounds like i should look up if ant-unit can help me out.
> I would appreciate any suggestions. (Apart from using resourcecount
> which is in ANT 1.7)
> Thanks for your time.
> -Prashant
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message