dr jerry
dr jerry

Reputation: 10026

sbt dependencies ignoring version

In my build.sbt files I'm stating that I want to use version 18.9 from a library:

val finagleVersion = "18.9.0"
<zip>
lazy val commonDependencies = Seq(
  <zip>,
  "com.twitter" %% "finagle-core" % finagleVersion,

but this seems to be ignored when I run sbt with

scalacOptions ++= (compilerOptions :+ "-Ylog-classpath"),

which outputs all the jars used at compile time. And there I see that for every finagle dependency including core the 19.3 version is used:

C:\Users\<me>\.coursier\cache\v1\https\<me>%40<company repo>\artifactory\Central-cache\com\twitter\finagle-core_2.12\19.3.0\finagle-core_2.12-19.3.0.jar

Where is this "preference" for the latest versions coming from?

Upvotes: 1

Views: 670

Answers (1)

user1516867
user1516867

Reputation: 331

After using evicted and seeing which library overrides the version you want, you can opt to use dependencyOverrides. For example:

dependencyOverrides += "com.twitter" %% "finagle-core" % "18.9.0"

You do have to be careful though as the library that depends on Finagle too may require the newer version and break if you use the older version. That is why you should really check first which library is evicting the old version, and validate if it's ok to do so.

Also important, this is a livy-only feature so the override won't be present in the published pom.xml!

Upvotes: 2

Related Questions