2017-10-19 26 views
3

當我在我的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. 

是什麼意思?

回答

3

這意味着你有不同的依賴關係,每個依賴關係使用不同版本的同一個庫。也就是說,circe和fs2依賴於貓0.9.0,其中路徑服務取決於1.0.0-MF。

現在,由於.ivy的工作方式,最新版本的依賴關係總是在運行時被挑選和加載。這意味着,例如,如果circe依賴於公共方法foo,它在cats 0.9.0中,並且不再在cat 1.0.0-MF(發送的字節碼不同)中可用,則程序將引發異常在運行時試圖調用foo,因爲1.0.0-MF沒有它。

+0

另請參閱關於[衝突管理](http://www.scala-sbt.org/release/docs/Library-Management.html#Conflict+Management)的sbt文檔 – laughedelic