2

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.

AtanL
  • 125
  • 5

1 Answers1

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