I have upgraded to Gradle 8.12 and I have this very simple task definition that is a part of a deploy task:
tasks.register('copyResources') {
doLast {
copy {
from project(':myProject').file('src/main/resources/schema.json')
into 'build/deploy'
}
}
}
However, it reports a warning because project
is used:
Build file 'X:\Project\myProject\build.gradle': line 44
Invocation of Task.project at execution time has been deprecated. This will fail with an error in Gradle 10.0. This API is incompatible with the configuration cache, which will become the only mode supported by Gradle in a future release. Consult the upgrading guide for further information: https://docs.gradle.org/8.12/userguide/upgrading_version_7.html#task_project
at build_5325j12ut850wdqiloxse0sel$_run_closure4$_closure9$_closure12.doCall$original(X:\Project\myProject\build.gradle:44)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
I think I found correct documentation but honestly I simply don’t understand what it says. Mostly because I don’t work with Gradle daily.
Could somebody tell me how to replace from project(':myProject').file('src/main/resources/schema.json')
line to a correct one?
Thank you!