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.
Asked
Active
Viewed 414 times
2

AtanL
- 125
- 5
-
related https://stackoverflow.com/questions/27584463 – tkruse Feb 07 '18 at 10:00
1 Answers
2
Internally Gradle uses Groovy's metaprogramming features, specifically methodMissing, to implement this capability. You can see how this is done in the DependencyHandler
implementation.

Mark Vieira
- 13,198
- 4
- 46
- 39