Last active
January 4, 2016 06:09
-
-
Save davidparsson/8580251 to your computer and use it in GitHub Desktop.
Gradle bug: Moving file creation from processResources to a dependency will remove the generated file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
task(copyInput, type: Copy) { | |
from 'input.txt' | |
into "${sourceSets.main.output.resourcesDir}" | |
} | |
processResources { | |
//dependsOn copyInput // Enable this line after first execution | |
from 'input.txt' // Disable this line after first execution | |
from 'anotherInput.txt' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gradle clean processResources | |
:clean | |
:processResources | |
BUILD SUCCESSFUL | |
Total time: 2.119 secs | |
$ ls build/resources/main/input.txt | |
build/resources/main/input.txt | |
$ # Modify build.gradle here, by enabling line 9 and disabling line 10. | |
$ gradle clean processResources | |
:clean | |
:copyInput | |
:processResources | |
BUILD SUCCESSFUL | |
Total time: 2.895 secs | |
$ ls build/resources/main/input.txt | |
ls: build/resources/main/input.txt: No such file or directory | |
$ # File should exist! | |
$ gradle clean processResources | |
:clean | |
:copyInput | |
:processResources | |
BUILD SUCCESSFUL | |
Total time: 2.036 secs | |
$ ls build/resources/main/input.txt | |
build/resources/main/input.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment