Had to mention the "include" section. without that, it'was copying all files into 0 bytes in the tree.
copy {
from "${buildDir}/tmp/warApplication"
into "${buildDir}/tmp/warApplication"
include "${thidsProjectName}-$project.version"
rename (/([a-z]+)-([0-9]+\.[0-9]+.+)/, 'newname-$2')
}
copy {
from "${buildDir}/tmp/warApplication/WEB-INF/classes"
into "${buildDir}/tmp/warApplication/WEB-INF/classes"
include "${thidsProjectName}.war.properties"
rename (/([a-z]+)\.war\.([a-z]+)/, 'newname.war.$2')
}
copy {
from "${buildDir}/tmp/warApplication/WEB-INF/classes"
into "${buildDir}/tmp/warApplication/WEB-INF/classes"
include "${thidsProjectName}.jar.properties"
rename (/([a-z]+)\.jar\.([a-z]+)/, 'newname.jar.$2')
}