You apply the plugin to the root project, but then try to use the extension in an allprojects { ... }
block.
This will work as long as you only have a root project as then allprojects { ... }
is just visual clutter.
But as soon as you have any other project, then for those other projects the extension is not there as the plugin is only applied to the root project.
The documentation of that plugin also states that you should do that only on the root project alone.
Generally using allprojects { ... }
or also any other means of doing cross-project configuration or even just model access is highly discouraged bad practice, as it immediately introduces project coupling and disturbs some more sophisticated Gradle features and optimizations. In the case you showed I would move group
and version
to gradle.properties
and the repositories to a dependencyResolutionManagement
block in the settings script, then your allprojects { ... }
is obsolete.
In other cases a convention plugin would be the way to go, for example implemented as precompiled script lugin, for example in buildSrc
or an included build.