Gradle way of processing resources with maven notation

I have few maven resource property files with ${} notation. I am working on migrating this project to gradle. processTestResources task is not replacing the values in ${}. Based on googling this is because gradle is using ant token identification which expects ‘@…@’ syntax.

How do we process resources in maven token format? i.e ${}

Is there any out-of-the box solution or should I have to write a custom processor?

I was able to do it thru ugly hack.

configure(tasks.processTestResources) {
    include '**/*.properties'
            tokens: ['$':'={'], beginToken : '=', endToken : '{')
            tokens: [], beginToken : '{', endToken : '}')

You can try using the built-in ‘expand’ support that uses the Groovy SimpleTemplateEngine:

Or you can use the Ant ‘ExpandProperties’ filter, as described at…

1 Like