Is there a way to install / use a regular expression instead of ReplaceTokens for a filter?

Right now I use

war {
     filter(ReplaceTokens, tokens: ['buildtime': buildTime() ])

But what if I want to replace tags in an HTML while coping these files into the WAR? (these tags can go over several lines… - so a line-based filter is not enough)


You could use ‘war.filesMatching’ together with some custom filtering code. Or perhaps there is already an Ant ‘FilterReader’ that fits your needs.

That filter() method takes a class that implements FilteredInputStream, which you can create your own implementation of if necessary.