I have a simple Gradle build script to compile and package (similar to the application plugin) my Java application. The only thing I do not accomplish is to replace the current version number in a simple .properties file.

I have created a file 'src/main/resources/app-info.properties' with a single line 'application.version = @version@'. No I want to replace this version string whenever the file is copied to the build folder (think this happens during the build task).

I already tried a simple solution with ants ReplaceTokens. This one replaced the version but also broke my .png files in the resources..

So is there a simple solution to just replace tokens in one single file during the build task (or whatever task handles the copy to the build folder)?

Thank you for any help!
Ben

====== Edit based on the comment from Opal =====

Based on the hint I have added the following: 

```
import org.apache.tools.ant.filters.ReplaceTokens
// ... 
build {
    from('src/main/resources') { 
        include '*.properties' 
        filter(ReplaceTokens, tokens: [version : project.version]) 
    } 
} 

```

Which throws this error:

> 
> Could not find method from() for arguments [src/main/resources, build\_vbjud9ah7v3pj5e7c5bkm490b$\_run\_closure6\_closure12@43ead1a8] on root project 
> 
> 
> 

Seems like I am on the wrong task?

====== Edit for completeness adding the solution based on Opals suggest =====

Thanks man, the following is the working solution!

```
processResources {
    from('src/main/resources') {
        include '*.properties'
        filter(ReplaceTokens, tokens: [version : project.version])
    }
}

```