I have a Spring Boot project. My application.properties has a line:
myproject.version=@version@
My build
I have a spring boot project. I need to set project version in application.properties from gradle.
I have tried to use filtering in processResources task and it worked but it affect to other files (corrupt images for example). Then i tried to use filter for only properties file but filter doesn't working inside "filesMatching" statement.
This works ok for replace version in properties but it crushes all images in app:
processResources {
filesMatching('**/application.properties') {
expand('version': version)
}
filter ReplaceTokens, tokens: [version: version]
}
But this code do nothing:
processResources {
filesMatching('**/application.properties') {
expand(project.properties)
filter ReplaceTokens, tokens: [version: version]
}
}
Please, help to understand how i can set property myproject.version in application.properties from gradle.