您的位置:首页 > 编程语言 > Java开发

《Springboot极简教程》问题解决:Idea解决Gradle库依赖冲突问题:Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting

2017-09-13 14:26 781 查看

错误日志

Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
at org.slf4j.impl.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:54)
... 11 more
:bootRun FAILED

Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path



classpath jar包冲突

gradle -q app:dependencies



依赖树分析

参考:
https://docs.gradle.org/current/userguide/userguide_single.html#sec:listing_dependencies

45down voteaccepted

So you have to exclude conflict dependencies. Try this:

<exclusions>
<exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId></exclusion>
<exclusion> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </exclusion>
</exclusions>

This solved same problem with slf4j .

Gradle

compile('org.raml:raml-parser:0.8.12'){
exclude module: 'slf4j-log4j12'
exclude module: 'log4j'
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: