使用Spring.IO依赖关系管理,如何覆盖特定jar的版本?

时间:2015-11-18 01:40:51

标签: spring gradle dependency-management

我正在使用aws java sdk,它依赖于比弹簧bom更大的jackson版本,我需要能够覆盖版本(使用与aws sdk更兼容的版本) )。如何覆盖特定jar的版本?

buildscript {
    repositories {
        maven { url "https://mvnrepo.----.net/nexus/content/groups/public/" }    
        }
    dependencies {
        classpath 'io.spring.gradle:dependency-management-plugin:0.5.3.RELEASE'
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'io.spring.dependency-management'

sourceCompatibility = 1.8
targetCompatibility = 1.8
version = 1.0

repositories {
    maven { url "https://mvnrepo.-----.net/nexus/content/groups/public/"}    
}

dependencyManagement {
    imports {
        mavenBom 'io.spring.platform:platform-bom:1.1.4.RELEASE'
    }
}
dependencies {


    compile 'org.springframework:spring-context',
            'org.springframework:spring-core',
            'org.springframework:spring-test',
            'com.amazonaws:aws-java-sdk-dynamodb:1.10.+',
            'com.amazonaws:aws-java-sdk-s3:1.10.+',
            'com.amazonaws:aws-java-sdk-sns:1.10.+',
            'com.amazonaws:aws-java-sdk-logs:1.10.+',
            'com.google.code.gson:gson',
            'joda-time:joda-time',
            'org.slf4j:slf4j-api'

    testCompile 'junit:junit:4.12',
                'org.mockito:mockito-core:1.+'
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.7'
}

1 个答案:

答案 0 :(得分:2)

dependencyManagement {
    imports {
        mavenBom 'io.spring.platform:platform-bom:1.1.4.RELEASE'
    }
    dependencies {
        dependency 'com.fasterxml.jackson.core:jackson-core:2.6.3'
        dependency 'com.fasterxml.jackson.core:jackson-databind:2.6.3'
        dependency 'com.fasterxml.jackson.core:jackson-annotations:2.6.3'
    }
}