匆匆那些年 2014-06-10
Scala Dependency and SBT
Recently, I met a problem that our Scala Project keep logging these Error Messages
SLF4J: Found binding in [jar:file:/Users/carl/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class][ERROR] SLF4J: Found binding in [jar:file:/Users/carl/.ivy2/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
From the documents, the default configuration for transitivity
intransitive(), notTransitive()
I guess the default configuration is intransitive(), and we have a lot of dependencies, so I do not which dependency bring me this conflicts.
So I need to put notTransitive() to every dependency.
for example:
"com.googlecode.flyway" % "flyway-core" % "2.2.1" notTransitive()
The I found the conflict was brought by kafka
"org.apache.kafka" % "kafka_2.10" % “0.8.0"
So I change the kafka as follow:
"org.apache.kafka" % "kafka_2.10" % "0.8.0" exclude("org.slf4j", "slf4j-simple"),
A command to show all the jar dependencies in our projects without publish-loca or something else is as follow:
>show compile:dependency-classpath
And here is another thing, conflict-managers
http://ant.apache.org/ivy/history/latest-milestone/settings/conflict-managers.html
conflictManager := ConflictManager.strict
References:
sbt document library management
http://www.scala-sbt.org/0.13.2/docs/Detailed-Topics/Library-Management.html
http://www.scala-sbt.org/0.13.2/api/index.html#sbt.ConflictManager$
Conflict Type Management
http://ant.apache.org/ivy/history/latest-milestone/settings/conflict-managers.html