I have a custom task with a ‘Configuration’ property. When I attempt to set this property using the property as a method, gradle reports a missing method exception.
Attempting to set the value using the ‘=’ equals sign works, as does manually creating the missing method.
in groovy when calling ‘cfg = configuration.compile’ under the hood, the method ‘setCfg(Configuration)’ is called. But there is no build-in support for the syntax you use in your “broken” task.
“cfg configuration.compile” will be resolved in groovy to call a method 'cfg(Configuration) which doesn’t match the property syntax of groovy. Gradle itself added some of these methods to it’s model classes to make the usage more convenient. This might have mislead you to the assumption this is build-in groovy syntax
My understanding is that “setter methods” are created for all task properties except collections. Since ‘Configuration’ extends ‘FileCollection’, no such method is created.