On my project, I'm updating my Gradle version from 2.3 to 4.1 and I ran into an issue when getting absolute path on a resource inside a custom task.
In version 2.3, the getResource
function returned the absolute path to the resource:
/Users/user/work/rootProject/buildSrc/src/main/resources/resource-name
In Gradle version 4.1 getResource
function returned the absolute path to the jar:
file:/Users/user/.gradle/caches/jars-3/d6ba6bacd01b220f9dc681b05b86d37c/buildSrc-1.0.jar!/resource-name
After retrieving the path I copy the resource to a different location, and therefore the build fails with the new behavior.
What is the best way to get the path of a resource under a custom task?
example: buildSrc/src/main/resources