Gradle task to rename file

Gradle allows to call ant tasks from your task implementation. It makes moving files as easy as

ant.move(file:'oldFile.txt', tofile:'newfile.txt')

For me this worked - does not leave source files (no duplications).

task pdfDistributions(type: Sync) {
    from('build/asciidoc/pdf/docs/asciidoc/')
    into('build/asciidoc/pdf/docs/asciidoc/')
    include '*.pdf'
    rename { String filename ->
        filename.replace(".pdf", "-${project.version}.pdf")
    }
}

The rename method should do the trick.

task renameArtifacts (type: Copy) {
    from ('project/')
    include 'project-1.5.jar'
    destinationDir file('project/')
    rename 'project-1.5.jar', "project.jar"
}