我有一个很大的疑问,我想在库中导入一个复杂的记录器,了解SL4J的方式,但是我不希望该记录器在客户端应用程序内部造成问题。
如何在内部导入库而又不会在客户端库中出现问题?
在我使用gradle的那一刻,广告具有此配置,此配置
dependencies {
// https://mvnrepository.com/artifact/org.swinglabs/swingx
compile group: 'org.swinglabs', name: 'swingx', version: '1.6.1'
compile group: 'com.github.jiconfont', name: 'jiconfont-bundle', version: '1.4.0'
implementation 'com.github.jiconfont:jiconfont-swing:1.0.1'
implementation 'com.github.jiconfont:jiconfont-google_material_design_icons:2.2.0.2'
//Slf4j configuration
implementation 'ch.qos.logback:logback-classic:1.2.3'
implementation 'ch.qos.logback:logback-core:1.2.3'
implementation 'org.slf4j:slf4j-api:1.7.25'
// Use JUnit test framework
testCompile 'junit:junit:4.12'
//assertj
testCompile group: 'org.assertj', name: 'assertj-swing-junit', version: '3.9.2'
//testCompile group: 'org.swinglabs', name: 'swingx', version: '1.6.1'
}
我也尝试过这种配置
//Slf4j configuration
testCompile 'ch.qos.logback:logback-classic:1.2.3'
testCompile 'ch.qos.logback:logback-core:1.2.3'
implementation 'org.slf4j:slf4j-api:1.7.25'
但是在第一种配置中,我会收到这样的异常
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/media/vincent/VincentHDD/JMARS_Developement/17_03_2020_JMars_Refactoring/UI/lib/slf4j-jdk14-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/media/vincent/VincentHDD/JMARS_Developement/17_03_2020_JMars_Refactoring/UI/lib/material-ui-swing-1.1.1.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 [org.slf4j.impl.JDK14LoggerFactory]
感谢您的时间,对不起这个愚蠢的问题