How gradle dependencies work

别等时光非礼了梦想. 提交于 2020-01-05 02:29:49

问题


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.



来源:https://stackoverflow.com/questions/32131860/how-gradle-dependencies-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!