Internal Error While Trying To Copy & Rename In Gradle 1.7

I have a gradle script (gradle 1.7) that is trying to do a copy and rename that is getting an internal error. Can somebody tell me what I am doing wrong.

The gradle script is: defaultTasks ‘exampleCopyTask’

task exampleCopyTask (type: Copy) {

from(projectDir) {

include ‘test.txt’

rename {it + ‘.actual’}

}

into projectDir }

The error is below.

Note if I change the into to “${projectDir}/temp” that works. Its copying (renaming) into the same source folder that appears to be the problem.

org.gradle.api.UncheckedIOException: java.io.IOException: The process cannot acc ess the file because another process has locked a portion of the file

at org.gradle.util.hash.HashUtil.createHash(HashUtil.java:56)

at org.gradle.util.hash.HashUtil.createHash(HashUtil.java:34)

at org.gradle.api.internal.changedetection.state.DefaultHasher.hash(Defa ultHasher.java:24)

at org.gradle.api.internal.changedetection.state.CachingHasher.hash(Cach ingHasher.java:42)

at org.gradle.api.internal.changedetection.state.DefaultFileSnapshotter$ 1.run(DefaultFileSnapshotter.java:48)

at org.gradle.internal.Factories$1.create(Factories.java:22)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAcc ess.java:143)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAcc ess.java:131)

at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(De faultPersistentDirectoryStore.java:134) etc…