3 回答
TA贡献1826条经验 获得超6个赞
当我检查时gradle dependencyInsight --dependency logback,我看到:
> Task :dependencyInsight
ch.qos.logback:logback-classic:1.1.3 (selected by rule)
variant "compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.libraryelements = jar (compatible with: classes)
org.gradle.category = library (not requested)
Requested attributes not found in the selected variant:
org.gradle.dependency.bundling = external
org.gradle.jvm.version = 8
]
ch.qos.logback:logback-classic:1.1.3
\--- compileClasspath
ch.qos.logback:logback-classic:1.2.3 -> 1.1.3
\--- org.springframework.boot:spring-boot-starter-logging:2.1.9.RELEASE
\--- org.springframework.boot:spring-boot-starter:2.1.9.RELEASE
+--- compileClasspath (requested org.springframework.boot:spring-boot-starter)
+--- org.springframework.boot:spring-boot-starter-web:2.1.9.RELEASE
| +--- compileClasspath (requested org.springframework.boot:spring-boot-starter-web)
| \--- org.springframework.boot:spring-boot-starter-websocket:2.1.9.RELEASE
| \--- compileClasspath
+--- org.springframework.boot:spring-boot-starter-json:2.1.9.RELEASE
| +--- org.springframework.boot:spring-boot-starter-web:2.1.9.RELEASE (*)
| \--- org.springframework.boot:spring-boot-starter-jersey:2.1.9.RELEASE
| \--- compileClasspath (requested org.springframework.boot:spring-boot-starter-jersey)
\--- org.springframework.boot:spring-boot-starter-validation:2.1.9.RELEASE
\--- org.springframework.boot:spring-boot-starter-jersey:2.1.9.RELEASE (*)
ch.qos.logback:logback-core:1.2.3 (selected by rule)
variant "compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.libraryelements = jar (compatible with: classes)
org.gradle.category = library (not requested)
Requested attributes not found in the selected variant:
org.gradle.dependency.bundling = external
org.gradle.jvm.version = 8
]
ch.qos.logback:logback-core:1.1.3 -> 1.2.3
\--- ch.qos.logback:logback-classic:1.1.3
+--- compileClasspath
\--- org.springframework.boot:spring-boot-starter-logging:2.1.9.RELEASE (requested ch.qos.logback:logback-classic:1.2.3)
\--- org.springframework.boot:spring-boot-starter:2.1.9.RELEASE
+--- compileClasspath (requested org.springframework.boot:spring-boot-starter)
+--- org.springframework.boot:spring-boot-starter-web:2.1.9.RELEASE
| +--- compileClasspath (requested org.springframework.boot:spring-boot-starter-web)
| \--- org.springframework.boot:spring-boot-starter-websocket:2.1.9.RELEASE
| \--- compileClasspath
+--- org.springframework.boot:spring-boot-starter-json:2.1.9.RELEASE
| +--- org.springframework.boot:spring-boot-starter-web:2.1.9.RELEASE (*)
| \--- org.springframework.boot:spring-boot-starter-jersey:2.1.9.RELEASE
| \--- compileClasspath (requested org.springframework.boot:spring-boot-starter-jersey)
\--- org.springframework.boot:spring-boot-starter-validation:2.1.9.RELEASE
\--- org.springframework.boot:spring-boot-starter-jersey:2.1.9.RELEASE (*)
(*) - dependencies omitted (listed previously)
A web-based, searchable dependency report is available by adding the --scan option.
似乎 Spring Boot 2.1.9 正在使用org.springframework.boot:spring-boot-starter-logging:2.1.9.RELEASE,它使用logback-classic:1.1.3. Google 的某个地方告诉我 Spring Boot 依赖管理有一个错误,该错误允许logback-core和logback-classic在这里出现不同的版本并导致冲突。
我添加了依赖项logback-core:1.1.3,问题就消失了。
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.1.3'
如果您遇到同样的问题,请务必检查 Spring Boot 中使用的 logback 版本。
TA贡献1868条经验 获得超4个赞
请尝试将这 3 个依赖项添加到您的 pom.xml 文件中。它对我有用..
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.3</version>
<scope>compile</scope>
</dependency>
添加回答
举报