When I walk through the gradle dsl guide, I notice the DependencyHandler. It's delegated to closure when execute dependencies method. Just like
dependencies {
compile 'commons-lang:commons-lang:2.6'
}
The point I can't understand is why "compile 'commons-lang:commons-lang:2.6'" caused the method "add(configurationName, dependencyNotation)" be invoked.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Internally Gradle uses Groovy's metaprogramming features, specifically methodMissing, to implement this capability. You can see how this is done in the DependencyHandler
implementation.