例如,在Gradle项目的依赖项中可以看到这一点:
+--- org.springframework.security:spring-security-core: -> 3.2.7.RELEASE
+--- aopalliance:aopalliance:1.0
+--- org.springframework:spring-beans:3.2.13.RELEASE -> 4.1.7.RELEASE (*)
+--- org.springframework:spring-expression:3.2.13.RELEASE -> 4.1.7.RELEASE (*)
+--- org.springframework:spring-aop:3.2.13.RELEASE -> 4.1.7.RELEASE (*)
+--- org.springframework:spring-context:3.2.13.RELEASE -> 4.1.7.RELEASE
| +--- org.springframework:spring-aop:4.1.7.RELEASE (*)
| +--- org.springframework:spring-beans:4.1.7.RELEASE (*)
| +--- org.springframework:spring-core:4.1.7.RELEASE (*)
| \--- org.springframework:spring-expression:4.1.7.RELEASE (*)
\--- org.springframework:spring-core:3.2.13.RELEASE -> 4.1.7.RELEASE (*)是否可以排除org.springframework:spring-expression而不首先将org.springframework:spring-context排除在org.springframework.security:spring-security-core之外?
发布于 2015-12-08 18:36:54
我建议将它添加到您的Gradle构建中,也许:
dependencies {
// Explicitly include spring-expression transitive dependency then manage its dependencies
compile('org.springframework:spring-context:3.2.13.RELEASE') {
transitive = false
}
}还可以强制使用“分级用户指南”中的特定传递依赖项见第52.4.2节。客户模块依赖关系
发布于 2015-12-08 17:09:00
为了从任何配置中排除依赖关系,请使用:
configurations {
all {
exclude group: 'org.springframework', module: 'spring-expression'
}
}如果要强制执行特定版本的依赖关系,可以使用:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.springframework') {
details.useVersion '3.2.13.RELEASE'
}
}
}如果在不同版本中多次提取传递依赖项,这可能会有所帮助。
https://stackoverflow.com/questions/34159871
复制相似问题