当我使用sbt在我的项目上执行任务compile
时,我收到以下错误消息:
[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.
这是什么意思?
答案 0 :(得分:5)
这意味着您有不同的依赖项,每个依赖项使用同一个库的不同版本。即,circe和fs2依赖于猫0.9.0,其中pathservice依赖于1.0.0-MF。
现在,由于.ivy的工作方式,始终在运行时选择并加载最新版本的依赖项。这意味着,例如,如果circe依赖于cat 0.9.0中的公共方法foo
,并且在1.0.0-MF(发出的字节码不同)中不再可用,那么你的程序在尝试调用foo
时会在运行时抛出异常,因为1.0.0-MF没有它。
答案 1 :(得分:0)
您甚至可以排除存在版本冲突的依赖项 示例:libraryDependencies + = “log4j”%“log4j”%“1.2.15”exclude(“javax.jms”,“jms”)
您可以更改要排除的依赖项。作为参考,您可以查看:https://www.scala-sbt.org/1.x/docs/Library-Management.html