我有一个使用 grails-plugin-log4j 运行的 Grails 应用程序。同时,我最近添加了一些 jar 文件,以便将外部功能集成到我的平台,但是,其中一个 JAR 的 slf4j-jdk14-1.7.2 是来自主 .jar 文件的依赖项功能。
显然,当我刷新项目的依赖项时,我收到以下消息:
错误 SLF4J:类路径包含多个 SLF4J 绑定(bind)
我试图从 BuildConfig 中排除 grails-plugin-log4j,但不幸的是,当日志消息发送到 log4j 时,应用程序没有运行。我也尝试排除其他依赖项,但我不知道如何排除它,因为我导入了太多 jar 文件以包含新功能......
有什么线索吗?
谢谢!
最佳答案
正如@dmahapatro 所说,用户 grails 命令执行 grails dependency-report第一的。搜索 log4j 或 slf4j。看看有没有重复的。
然后,在您的 BuildConfig.groovy 中,使用
runtime('com.mysql:mysql-connector-java:5.1.16',
'net.sf.ehcache:ehcache:1.6.1') {
excludes "xml-apis", "commons-logging"//exclude the duplicate jar, may not be these two
}
关于Grails jar依赖重复的log4j绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23364246/