Gradle 渐变解决策略不更新运行时

Gradle 渐变解决策略不更新运行时,gradle,build.gradle,Gradle,Build.gradle,在我的gradle构建脚本中,我强制使用spring framework的3.1.0版本库。我看到这个解析策略更改应用于compile、testCompile和testRuntime,但不应用于从“gradle dependencies”输出可见的运行时 allprojects { configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails detail

在我的gradle构建脚本中,我强制使用spring framework的3.1.0版本库。我看到这个解析策略更改应用于compile、testCompile和testRuntime,但不应用于从“gradle dependencies”输出可见的运行时

allprojects {
        configurations.all {
            resolutionStrategy.eachDependency { DependencyResolveDetails details ->
                if ( details.requested.group == 'org.springframework' ) { 
                    details.useVersion = '3.1.0.RELEASE'
                }
            }
        }
    }
渐变依赖项输出:

compile - Compile classpath for source set 'main'.
+--- org.codehaus.groovy:groovy-all:2.1.1
+--- com.company.mod1:module1:2.21.2
|+--
org.springframework:springcore:3.0.0.RC1->3.1.0.RELEASE

  |    |    +--- org.springframework:spring-asm:3.1.0.RELEASE
    |    |    \--- commons-logging:commons-logging:1.1.1
    |    +--- org.springframework:spring-context:3.0.0.RC1 -> 3.1.0.RELEASE
    |    |    +--- org.springframework:spring-aop:3.1.0.RELEASE
    |    |    |    +--- aopalliance:uopalliance:1.0
    |    |    |    +--- org.springframework:spring-asm:3.1.0.RELEASE


runtime - Runtime classpath for source set 'main'.
+--- org.codehaus.groovy:groovy-all:2.1.1
+--- com.company.mod1:module1:2.21.2
|    +--- org.springframework:spring-core:3.0.0.RC1
|    |    +--- org.springframework:spring-asm:3.0.0.RC1
|    |    \--- commons-logging:commons-logging:1.1.1
|    +--- org.springframework:spring-context:3.0.0.RC1
|    |    +--- aopalliance:aopalliance:1.0
|    |    +--- org.springframework:spring-asm:3.0.0.RC1
|    |    +--- org.springframework:spring-aop:3.0.0.RC1
|    |    |    +--- aopalliance:aopalliance:1.0
|    |    |    +--- org.springframework:spring-asm:3.0.
正如您可以编译依赖项一样,3.1.0.RELEASE已经编写完成,但运行时没有。因此,当我为我的项目jar分发zip时,我看到了3.0.0。版本spring库

这是我的覆盖或解决策略的问题吗?它不影响运行库库?
我是否需要在distZip任务中包含编译依赖项?但这可能会在存档中创建重复的lib。

找到原因。resolutionStrategy代码方法位于构建脚本的底部。一旦我将它移到所有与子项目相关的构建代码之上,它也反映了运行时依赖关系