Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT: is it wise to fix eviction warnings of library dependencies

Tags:

scala

sbt

Is it a good idea to fix SBT eviction warning messages?

By overriding the version of the evicted libraries to the latest. Would that force SBT to stick with the overridden version for life? Would SBT still notify us that there are newer versions in the future?

Example of eviction warnings (SBT 0.13.13)

[warn] There may be incompatibilities among your library dependencies. [warn] Here are some of the libraries that were evicted: [warn]  * com.chuusai:shapeless_2.11:1.2.4 -> 2.3.2 [warn]  * org.postgresql:postgresql:9.4-1201-jdbc41 -> 9.4.1208.jre7 [warn]  * jline:jline:0.9.94 -> 2.12.1 [warn] Run 'evicted' to see detailed eviction warnings 

Remove the warnings by adding this at the end of build.sbt. Following the instructions in SBT Documentation Eviction warning

dependencyOverrides ++= Set(   "org.postgresql" % "postgresql" % "9.4.1208.jre7",   "com.chuusai" %% "shapeless" % "2.3.2",   "jline" % "jline" % "2.12.1" ) 
like image 850
Polymerase Avatar asked Feb 28 '17 22:02

Polymerase


1 Answers

If these warnings are for dependencies you use directly in your code, you should definitely add the upgraded version to your libraryDependencies.

For evicted transitive dependencies (those dependencies only used directly by your own dependencies), it's likely best to simply leave the warnings in place. This provides documentation to you about possible incompatibilities in your dependencies, and could help you debug runtime problems that arise due to such incompatibilities.

Remember, setting dependencyOverrides merely hides the warning, it doesn't guarantee compatibility between your libraries and the version you set.

like image 184
jkinkead Avatar answered Sep 22 '22 08:09

jkinkead