【发布时间】:2017-04-21 10:12:20
【问题描述】:
我在子项目中定义了一个依赖,例如:
testCompile(
"org.springframework:spring-test:4.3.7-RELEASE",
)
我的主要 build.gradle 覆盖了 resolutionStrategy:
subprojects {
configurations {
compileClasspath.transitive = false
testCompileClasspath.transitive = false
all*.resolutionStrategy {
eachDependency { details ->
def requested = details.requested
switch (requested.group) {
case 'org.springframework':
details.useVersion '4.3.7-RELEASE'
break
}
}
}
}
}
但是依赖被解析为(sn-p):
+--- org.springframework:spring-test:4.3.7.RELEASE (*)
| +--- org.springframework:spring-core:4.3.7.RELEASE
| \--- org.springframework:spring-aop:4.3.7.RELEASE
| +--- org.springframework:spring-beans:4.3.7.RELEASE
| | \--- org.springframework:spring-core:4.3.7.RELEASE
| \--- org.springframework:spring-core:4.3.7.RELEASE
| | \--- org.springframework:spring-context:4.3.7.RELEASE
| | +--- org.springframework:spring-aop:4.3.7.RELEASE (*)
| | +--- org.springframework:spring-beans:4.3.7.RELEASE (*)
| | +--- org.springframework:spring-core:4.3.7.RELEASE
| | \--- org.springframework:spring-expression:4.3.7.RELEASE -> 4.3.0.RC2
| | \--- org.springframework:spring-core:4.3.0.RC2 -> 4.3.7.RELEASE
注意org.springframework:spring-expression:4.3.7.RELEASE -> 4.3.0.RC2
为什么会这样?
我正在使用 Gradle 3.5
【问题讨论】:
标签: gradle dependencies