据我所知,当发生冲突时,gradle应该解决最新的依赖关系
但是在下面的依赖树中,我可以看到更低的依赖正在得到解决,有人能告诉我为什么会发生这种情况吗?
org.apache.logging.log4j:log4j-to-slf4j:2.17.2
-> 2.13.3
+--- 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文件看起来像这样
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'
}
}发布于 2022-11-15 12:58:25
只要简单地覆盖主jar,就可以得到想要的东西。
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验证前后
https://stackoverflow.com/questions/74444572
复制相似问题