Variable substition in filter replace string


(jeffrey gaer) #1

I am trying to use the ReplaceToken filter to insert the version into a file.

The following snippet with the version hardcoded works

filter(ReplaceTokens, tokens:['suiteName':"app-geo-sensor-functional",'version':"123"])

but if I try to use a variable as the value
filter(ReplaceTokens, tokens:[‘suiteName’:“app-geo-sensor-functional”,‘version’:"${project.version}"])

The build fails
Execution failed for task ‘:buildTemplateZip’.
Could not add file …


(Mark Vieira) #2

I believe this is because the Ant ReplaceTokens filter balks at an instance of GString. Try "${project.version}".toString(). Or in this case since there is no benefit to using string interpolation just pass project.version.


(jeffrey gaer) #3

thanks that worked ( just using project.version)