This message was deleted.
# plugin-development
s
This message was deleted.
t
As long as your plugin doesn't register the task in another project, then
Task::getProject
should be the same. But I'd say the task shouldn't access the project by itself, either the plugin should configure task's properties with values computed from the project: or the task should be injected services rather than accessing them on the project (e.g. inject
ObjectFactory
or
ExecOperations
rather than using
Project#getObjects
resp. `Project#exec`/`Project#javaExec`); see https://docs.gradle.org/current/userguide/custom_gradle_types.html#service_injection
j
it is not inside the task class, in the registering block
Copy code
register<Foo>("someTask") {
   this.project
   target
}
t
I would use the
project
passed to the plugin then, but that shouldn't really matter (even with configuration cache enabled afaict)
thank you 1