Gradle在解决后无法更改配置策略:“可选”。

时间:2017-03-28 03:35:58

标签: gradle jackson gradlew fasterxml

我正在尝试强制使用com.fasterxml.jackson.core的版本,但是,当我配置如下所示时,它将不允许我强制使用版本的依赖项并向我发送错误。

的build.gradle:

allprojects {
       dependencies {
        testCompile "junit:junit:$junitVer"
        testCompile "org.mockito:mockito-all:$mockitoVer"
        compile "org.springframework:spring-context:$springVer"

        // logging
        compile "org.slf4j:slf4j-api:$slf4jVer"
        compile "org.slf4j:slf4j-ext:$slf4jVer"
        compile "org.slf4j:jcl-over-slf4j:$slf4jVer"
        compile "org.slf4j:jul-to-slf4j:$slf4jVer"
        compile "org.slf4j:log4j-over-slf4j:$slf4jVer"

        compile "ch.qos.logback:logback-core:$logbackVer"
        compile "ch.qos.logback:logback-classic:$logbackVer"
    }

    configurations.all {
        resolutionStrategy {
            force "com.fasterxml.jackson.core:jackson-annotations:$jacksonVer"
            force "com.fasterxml.jackson.core:jackson-core:$jacksonVer"
            force "com.fasterxml.jackson.core:jackson-databind:$jacksonVer"
            force "com.fasterxml.jackson.module:jackson-module-afterburner:$jacksonVer"
            force "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jacksonVer"
            force "com.fasterxml.jackson.jaxrs:jackson-jaxrs-xml-provider:$jacksonVer"

            cacheChangingModulesFor 0, 'seconds'
        }
    }
}

错误是:

Cannot change strategy of configuration ':optional' after it has been resolved. 

有什么想法吗?

0 个答案:

没有答案