当我构建我的Gradle项目时,我得到了以下错误:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/qliu/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.0.6/ba738848da3e6fffa0107771c75546eb6d407f3c/logback-classic-1.0.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/qliu/.gradle/caches/modules-2/files-2.1/uk.org.lidalia/slf4j-test/1.1.0/f4f523049e041dea673bd421d7b0d61fb5e49548/slf4j-test-1.1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.selector.DefaultContextSelector]我的Gradle构建文件:
dependencies {
// for output logger messages
compile group: 'log4j', name: 'log4j', version: '1.2.17'
// for testing outputed logger messages
compile group: 'uk.org.lidalia', name: 'slf4j-test', version: '1.1.0'
}如何删除警告?
发布于 2014-08-08 14:56:21
您可以尝试通过resolutionStrategy来解决这个问题,例如:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.name == 'log4j') {
details.useTarget 'log4j:log4j:1.2.+'
}
}
}请参阅文档:http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
但是如果你在SLF4J网站上读到这张便条,它说这只是一个警告:bindings
The warning emitted by SLF4J is just that, a warning. Even when multiple bindings are present, SLF4J will pick one logging framework/implementation and bind with it.
https://stackoverflow.com/questions/24440979
复制相似问题