首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >分级依赖解决到较低版本

分级依赖解决到较低版本
EN

Stack Overflow用户
提问于 2022-11-15 11:06:08
回答 1查看 43关注 0票数 1

据我所知,当发生冲突时,gradle应该解决最新的依赖关系

但是在下面的依赖树中,我可以看到更低的依赖正在得到解决,有人能告诉我为什么会发生这种情况吗?

org.apache.logging.log4j:log4j-to-slf4j:2.17.2

-> 2.13.3

代码语言:javascript
复制
+--- org.springframework.boot:spring-boot-starter-logging:2.6.8
|    +--- ch.qos.logback:logback-classic:1.2.11 -> 1.2.3
|    |    +--- ch.qos.logback:logback-core:1.2.3
|    |    \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
|    +--- org.apache.logging.log4j:log4j-to-slf4j:2.17.2 -> 2.13.3
|    |    +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
|    |    \--- org.apache.logging.log4j:log4j-api:2.13.3
|    \--- org.slf4j:jul-to-slf4j:1.7.36 -> 1.7.30
|         \--- org.slf4j:slf4j-api:1.7.30

我的gradle.build文件看起来像这样

代码语言:javascript
复制
plugins {
id 'org.springframework.boot' version '2.4.4'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'com.google.cloud.tools.jib' version '2.0.0'
id 'java'
id 'org.sonarqube' version '3.3'
}

group = 'com.cox.cns'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
developmentOnly
  runtimeClasspath {
    extendsFrom developmentOnly
 }
}

repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
}

dependencies {

implementation 'com.oracle.database.jdbc:ojdbc8'
implementation group: 'com.jcraft', name: 'jsch', version: '0.1.55'
implementation 'io.github.resilience4j:resilience4j-spring-boot2:1.7.0'
implementation 'org.springframework.boot:spring-boot-starter-logging:2.6.8'
implementation ('org.springframework.boot:spring-boot-starter-aop'){
exclude group : 'org.springframework.boot' , module:'spring-boot-starter-logging'
}
implementation 'com.amazonaws:aws-java-sdk-sqs'
implementation 'com.amazonaws:amazon-sqs-java-messaging-lib:1.0.8'
implementation 'org.springframework.boot:spring-boot-starter-activemq'
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation 'com.amazonaws:aws-java-sdk-sns:1.11.964'
implementation 'com.amazonaws:aws-java-sdk-s3:1.11.851'
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'javax.mail:mail:1.4.7'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'
implementation 'org.springframework.cloud:spring-cloud-starter-aws- 
messaging:2.2.6.RELEASE'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
    exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}

}
EN

回答 1

Stack Overflow用户

发布于 2022-11-15 12:58:25

只要简单地覆盖主jar,就可以得到想要的东西。

代码语言:javascript
复制
    implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.17.2'
    implementation 'com.oracle.database.jdbc:ojdbc8'
    implementation 'com.jcraft:jsch:0.1.55'
    implementation 'io.github.resilience4j:resilience4j-spring-boot2:1.7.0'
    implementation ('org.springframework.boot:spring-boot-starter-aop')
//    {
//        exclude group : 'org.springframework.boot' , module:'spring-boot-starter-logging'
//    }
//implementation 'org.springframework.boot:spring-boot-starter-logging:2.6.8'

您可以使用./gradlew dependencyInsight --configuration runtimeClasspath --dependency log4j-to-slf4j验证前后

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74444572

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档