My plugin can't be applied when plugin is built with Gradle 7.1.1

I have a plugin which contains all the common build logic I use for 40+ projects. I was trying to upgrade the build of the plugin itself to use Gradle 7.1.1. The plugin builds fine. However, when I try to apply it to one of my projects (which is still using Gradle 6.8.2) I get the following error (with some identifying information redacted):

Receiver class redacted.RedactedPlugin does not define or inherit an implementation of the resolved method ‘abstract java.lang.Object getProperty(java.lang.String)’ of interface groovy.lang.GroovyObject.

I thought maybe this was due to Gradle 7 using Groovy 3 but I can’t find anything in the Gradle 7 release notes regarding this method in the section that mentions the groovy 3 upgrade and I can’t find anything about this in the Developing Custom Plugins doc either (Developing Custom Gradle Plugins).

Can anyone provide any insight?

Is it maybe not possible to use a plugin built with Gradle 7 in a project still using Gradle 6.8.x?

1 Like

So with some testing I discovered you can’t build a plugin with Gradle 7.1.x and then use that plugin in a project built with Gradle 6.8.x. This means I can’t upgrade the build of my plugin to 7.1.x until all the projects that use it are upgraded as well, slightly annoying but not that big of a deal.

Did you try Gradle 6.9?

Yes, all is also well if I build the plugin with gradle 6.9 i.e. if I build the plugin with gradle 6.9 it can be used in a project still using gradle 6.8.x.

You can try to add --stacktrace when you invoke the Gradle task to narrow down the error source.

Thanks for this - it helped me figure out what was wrong (same situation as you) because the error is not clear at all that this is the case.