How to rename jar file inside ear file

I try to generate an ear file which includes jar files without version information (in root and lib directory). The ear file includes jar files from a local repository and others from the same project. All jar files include a version information.

I was very happy to find the ear.rename method and used it like: ear.rename ‘(.)-’ + VERSION + '(.)’, ‘$1$2’

apply plugin: 'ear'
  dependencies {
   deploy project(path: ':sameproject.myproject1', configuration: 'archives')
   deploy group: 'org.mygroup', name: 'fromrepository.myproject2', version: '1.0'
   earlib group: 'org.mygroup', name: 'fromrepository.myproject3', version: '1.0'
  ear.rename '(.*)-1.0(.*)', '$1$2'

This works very fine – but – only for the files in the root directory. How can I remove the version from the files in the lib directory?