Gradle 仅针对特定的传递依赖强制下载不同的版本

Gradle force download a different version only for a particular Transitive dependency

我是 force-downloading 使用以下 gradle-脚本的依赖项

implementation ('org.springframework.boot:spring-boot-starter-webflux:2.2.2.RELEASE') {
        force = true
}

这种依赖总是给我带来3.2.13.RELEASE版本的io.projectreactor:reactor-core(传递依赖)

但我想要 3.3.0.RELEASEio.projectreactor:reactor-core

下面是我的全build.gradle

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.2.1.RELEASE'
    id 'maven-publish'
    id 'jacoco'
    id 'org.sonarqube' version '2.7'
}





apply plugin: 'io.spring.dependency-management'
dependencyManagement {
    imports {
        mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Greenwich.SR3'
        mavenBom 'io.pivotal.spring.cloud:spring-cloud-services-dependencies:2.1.1.RELEASE'
        mavenBom  org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
    }
}


dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.security:spring-security-oauth2-client'

    implementation 'org.springframework.boot:spring-boot-starter-webflux'

    implementation 'org.springframework.boot:spring-boot-starter-web'

    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.cloud:spring-cloud-starter-sleuth'
    implementation 'io.springfox:springfox-swagger2:2.9.2'
    implementation 'io.springfox:springfox-swagger-ui:2.9.2'

    //security
    implementation 'org.springframework.boot:spring-boot-starter-security'


    //other
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'


}

如何在 gradle 中强制只下载这个特定的依赖项?

使用 resolutionStrategy 比如:

configurations.all {
    resolutionStrategy {
        force 'io.projectreactor:reactor-core:3.3.0.RELEASE'
    }
}