while it is mentioned in the documentation of the Project class (mentioned through this blog series) that there is a one-to-one correlation from this class to a build.gradle file, and I can presume any top function call that I see being used in the build.gradle belongs/is exposed through that class, thus I can find it the class documentation, I still find it hard/unclear where does mavenCentral() function come from. what makes this function available in the lambda that is passed to Project.repositories()?
it was definitely very useful the explanation for the groovy/kotlin sugar code that allows this dsl in .gradle file, in terms of function calls and lambdas as parameters.
I find it hard to track down where those lambas get acces to functions. do they come from the Project class? is there some hidden/magic method injection that happens elsewhere (not defined in the Project class itself) and thus trying to follow a class definition, from an ide, fails
also, I find it hard also to track down who adds methods to gradle core classes (except what is mentioned in the javadocs themselves). some enlightenment here would be helpful (maybe it will come in the plugin internals post)
The lambda you give to repositories has a different delegate.
It is of type RepositoryHandler where you also find the mavenCentral() method.
Basically any object created through Gradle also is ExtensionAware, even if it does not declare it explicitly.
And to all those objects any plugin can add extensions that then provide some additional DSL that you will not find in the JavaDoc / GroovyDoc / DSL doc / …, but only in the documentation of that plugin.
I can strongly recommend to use the Kotlin DSL instead of the Groovy DSL.
You immediately get type-safe accessors, helpful error messages if you mess up syntax, and an amazingly better IDE support if you use a proper IDE like IntelliJ IDEA. You will then also get code-completion and navigation for added extensions and so on and can clearly see where you have which types available.