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

(Mike Mitterer) #1

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)


(Peter Niederwieser) #2

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

(Luke Daley) #3

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