Let’s imagine we have properties file with jdbc.url=${jdbc.url} As far as ReplaceTokens can’t operate on any tokens longer than 1 char ( {jdb.url} will work. Same with ${…} will not) we have to strip ‘$’ somehow. DeleteCharacters looks suitable but then I do
filter(TokenFilter.DeleteCharacters, chars: '\$')
it leads to
Caused by: org.gradle.api.InvalidUserDataException: Error - Invalid filter specification for org.apache.tools.ant.filters.TokenFilter$DeleteCharacters
Any ideas what is going on? Thanks
Ofc, I can replace this call by filter {line -> line.replace ‘abc’, ‘’} but looking for explanation.
TokenFilter.DeleteCharacters implements TokenFilter.Filter and gradle does not support this kind of filter. I think the expand() method can solve your problem. here’s an example:
maybe I phrased it badly. The problem is not that TokenFilter.DeleteCharacters implements TokenFilter.Filter, but that it does not extend from java.io.FilterReader. Have a look at the javadoc of the filter method for the details:
Most stupid question ever. I read that FilterReader about 5 times, I knew that DeleteCharacter doesn’t inherit it and checked hierachy about 7 times but I was looking for interfaces only. It even didn’t came into my head that someone can use particular classes and not the interface to distinct the classes…