英文:
Gradle force download a different version only for a particular Transitive dependency
问题
I am force-downloading
a dependency using the below gradle-script
implementation ('org.springframework.boot:spring-boot-starter-webflux:2.2.2.RELEASE') {
force = true
}
This dependency always brings me 3.2.13.RELEASE
version of io.projectreactor:reactor-core
(transitive dependency)
But i want to have 3.3.0.RELEASE
of io.projectreactor:reactor-core
Below is my full 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'
}
How to force download only this particular dependency in gradle ?
英文:
I am force-downloading
a dependency using the below gradle-script
implementation ('org.springframework.boot:spring-boot-starter-webflux:2.2.2.RELEASE') {
force = true
}
This dependency always brings me 3.2.13.RELEASE
version of io.projectreactor:reactor-core
(transitive dependency)
But i want to have 3.3.0.RELEASE
of io.projectreactor:reactor-core
Below is my full 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'
}
How to force download only this particular dependency in gradle ?
答案1
得分: 2
使用 resolutionStrategy 如下:
configurations.all {
resolutionStrategy {
force 'io.projectreactor:reactor-core:3.3.0.RELEASE'
}
}
英文:
Use a resolutionStrategy like:
configurations.all {
resolutionStrategy {
force 'io.projectreactor:reactor-core:3.3.0.RELEASE'
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论