The gradle 8.7 plugins documentation says the following which does not compile for me (using gradlew 8.7). From what I can tell, the maven block must be inside the repositories block.
And the location of the plugin must be specified in the settings file:
settings.gradle
pluginManagement {
repositories {
gradlePluginPortal()
}
maven {
url 'https://maven.example.com/plugins'
}
}