Possible bug with "rename" in Copy tasks


(Chris Warren) #1

Here’s my test build.gradle contents:

task copyTest(type: Copy) {
    from 'src/this+that.txt'
    into 'build'
    rename 'this+that.txt', 'justthis.txt'
}

When I run “gradle copyTest”, it does copy the file from “src” into “build”, but it doesn’t rename it. If I rename the initial file so that it doesn’t have a plus character in the filename, the renaming works as expected.


(Benjamin Muschko) #2

The first parameter of the rename method is a regular expression. You’ll have to escape the plus sign with two backslashes.


(Chris Warren) #3

I did not realize it was a regex. Sorry for the confusion.