slf4j jar包冲突解决方案

来源:互联网 发布:什么是js脚本 编辑:程序博客网 时间:2024/05/29 13:22

国外原文地址 :点击打开链接


今天碰到的问题,项目中不同的两个jar包分别依赖了相同的一个jar包的不同版本,造成冲突。

解释:就是说项目中要用到某一个a.jar包,通过maven引入了之后,也自动的导入了该jar包所依赖的包,这里就会存在一个问题,如果a.jar包依赖b.jar这个项目的1.0版本,可是我的项目中已经有b.jar这个项目2.0的版本了,这里就会造成冲突,解决的办法是去除a.jar包依赖b.jar这个项目的1.0版本的依赖关系,让项目使用我已有的包。


You are mixing the 1.5.6 version of the jcl bridge with the 1.6.0 version of the slf4j-api; this won't work because of a few changes in 1.6.0. Use the same versions for both, i.e. 1.6.1 (the latest). I use the jcl-over-slf4j bridge all the time and it works fine.

这给了我启发

我的项目中用到了2个不同版本的slf4j-api,而其中一个是1.5.8版本,另一个是1.7.6版。



This can be caused when a dependent library has accidentally bundled an old version of slf4j. 

The work around is exclude the component and then manually depend on the correct or patched version.


造成这种情况的原因上面已经说过,分别由2个不同的jar包分别依赖了不同版本的slf4j,而该jar包的1.6.0版本对其中一个方法做了改动,所以1.6.0以前的版本和1.6.0以后

的版本会造成编译错误。

SLF4J 1.5.11 and 1.6.0 versions are not compatible (see compatibility report) because the argument list of org.slf4j.spi.LocationAwareLogger.log method has been changed (added Object[] p5):

版本改动具体如下


解决方案

首先要找出冲突的jar包的依赖关系,用我的项目举例,我的pom里引入了 FCKeditor.Java Integration Core 2.6

其依赖于slf4j.api 1.5.8 (依赖关系可在http://mvnrepository.com/ 找到)

找出依赖关系后只需要解除其依赖关系即可。



去掉了旧版本的依赖后,就不会报错了。

0 0
原创粉丝点击