Sbt slf4j exception not working

I have a third-party dependency in my game project. This third-party library has a potential dependency (and not directly) on the slf4j implementation.

I get a duplicate binding error for slf4j.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:~/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/~/.ivy2/cache/com.orgname.platform/platform-logging-client/jars/platform-logging-client-2.5.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]

I tried the following things, but I can get rid of this error.

"com.orgname.platform" % "platform-metric-client" % "1.0.4" excludeAll(
    ExclusionRule(organization = "org.slf4j"))

I also tried to exclude

"com.orgname.platform" % "platform-metric-client" % "1.0.4" exclude("org.slf4j","slf4j-jdk14)

as well as this

 "com.orgname.platform" % "platform-metric-client" % "1.0.4" exclude("org.slf4j","slf4j-log4j12)

Since I was unable to remove slf4j from third-party dependencies, I was tired of removing the playback dependency from slf4j by changing projcts / plugin.sbt

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.6" exclude("org.slf4j", "slf4j-simple"))

How do I get rid of this warning. How does this warning affect registration? Which logging implementation will be used in the Scala implementation?

+4
source share
3

YourBestBet , , .

//dependencies with exclusions
libraryDependencies ++= Seq(
    //depencies
).map(_.exclude("org.slf4j", "*"))

//insert one without exclusion
libraryDependencies ++= Seq(
  "ch.qos.logback" % "logback-classic" % "1.1.3"
)
+2

IMHO, . slf4j THAT, slf4j . , , slf4j, exclude("org.slf4j","slf4j-log4j12).

- exclude("org.slf4j","slf4j-log4j12) libraryDepencies. , .

+1

SBT, SLF4J provided, SBT classpath. libraryDependencies:

"org.slf4j" % "slf4j-simple" % "1," Provided

It is possible that various dependencies (or their transitive dependencies) may refer to SLF4J with different versions. This is why I used the Ivy version range matcher . You may find that the actual layout you need is a few options for what I wrote.

0
source

All Articles