Moving file creation from processResources to a dependency will remove the generated file on the next build

(David Pärsson) #1

If a resource is created by processResources, and then moved to be created by a task that is a dependency of processResources, the file will first be created by the new task and then incorrectly removed by processResources on the next build. The following build everything will work again though.

See this Gist for more details:

(Luke Daley) #2

Regardless of whether this is classed as a bug or not, you should never have two tasks writing to the same place. It breaks incremental build. This is better…

task(copyInput, type: Copy) {
    from 'input.txt'
    into "$buildDir/input"
   processResources {
    from copyInput
    from 'anotherInput.txt'

(David Pärsson) #3

Thanks, I ended up solving it that way, and I see your point.