softshipper
softshipper

Reputation: 34099

Version conflict: some are suspected to be binary incompatible

When I execute the task compile on my project with sbt, I've got following error message:

[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]  * org.typelevel:cats-core_2.12:1.0.0-MF is selected over 0.9.0
[warn]      +- default:pathservice_2.12:0.1                       (depends on 1.0.0-MF)
[warn]      +- io.circe:circe-core_2.12:0.8.0 ()                  (depends on 0.9.0)
[warn]      +- co.fs2:fs2-cats_2.12:0.3.0                         (depends on 0.9.0)
[warn] Run 'evicted' to see detailed eviction warnings
[info] Compiling 3 Scala sources to /home/developer/Desktop/microservices/backup-industry/PathService/target/scala-2.12/classes ...
[info] Done compiling.

What does it mean?

Upvotes: 9

Views: 3524

Answers (2)

Jasmine Kaur
Jasmine Kaur

Reputation: 21

You can even exclude the dependency which has version conflict Example: libraryDependencies += "log4j" % "log4j" % "1.2.15" exclude("javax.jms", "jms")

You can change the dependency to be excluded. For reference you can have a look at this: https://www.scala-sbt.org/1.x/docs/Library-Management.html

Upvotes: 2

Yuval Itzchakov
Yuval Itzchakov

Reputation: 149608

It means that you have different dependencies, each utilizing different version of the same library. Namely, circe and fs2 are relying on cats 0.9.0, where pathservice is depending on 1.0.0-MF.

Now, due to the way .ivy works, the latest version of the dependency is always picked and loaded at runtime. What this means is that, for example, if circe depends on public method foo which is in cats 0.9.0, and is no longer available in cats 1.0.0-MF (the emitted bytecode is different), your program will throw an exception at runtime when trying to invoke foo, since 1.0.0-MF doesn't have it.

Upvotes: 7

Related Questions