gradle 依赖项如何工作
How gradle dependencies work
当我浏览 gradle dsl 指南时,我注意到 DependencyHandler。它在执行依赖项方法时委托给闭包。就像
dependencies {
compile 'commons-lang:commons-lang:2.6'
}
我无法理解的一点是为什么 "compile 'commons-lang:commons-lang:2.6'" 导致方法 "add(configurationName, dependencyNotation)" 被调用。
在内部 Gradle 使用 Groovy 的元编程功能,特别是 methodMissing, to implement this capability. You can see how this is done in the DependencyHandler
实现。
当我浏览 gradle dsl 指南时,我注意到 DependencyHandler。它在执行依赖项方法时委托给闭包。就像
dependencies {
compile 'commons-lang:commons-lang:2.6'
}
我无法理解的一点是为什么 "compile 'commons-lang:commons-lang:2.6'" 导致方法 "add(configurationName, dependencyNotation)" 被调用。
在内部 Gradle 使用 Groovy 的元编程功能,特别是 methodMissing, to implement this capability. You can see how this is done in the DependencyHandler
实现。