Home > Software engineering >  How do I change the version of a dependency in a Scala application that I haven't set?
How do I change the version of a dependency in a Scala application that I haven't set?

Time:11-14

I am trying to build a Scala play application and a dependency is suddenly failing to download due to the repo no longer being up

Full stack trace below. I used to get the scalaz-stream v0.7a dependency just fine but it seems to no longer be up on the website. There is a snapshot-0.7a which I would to use.. however I just need to know how to switch the version over to this one?

I have no idea where the scalaz dependency is coming from or where it's defined.. I haven't set it myself and if I search all files within the directory there's no mention of scalaz

There must be somewhere I can just change it from 0.7a to snapshot-0.7a

[info] Resolving jline#jline;2.12.1 ...
[warn]  [FAILED     ] org.scalaz.stream#scalaz-stream_2.11;0.7a!scalaz-stream_2.11.jar(bundle):  (0ms)
[warn] ==== local: tried
[warn]   /home/vagrant/.ivy2/local/org.scalaz.stream/scalaz-stream_2.11/0.7a/bundles/scalaz-stream_2.11.jar
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/scalaz/stream/scalaz-stream_2.11/0.7a/scalaz-stream_2.11-0.7a.jar
[warn] ==== maven-central: tried
[warn]   https://repo1.maven.org/maven2/org/scalaz/stream/scalaz-stream_2.11/0.7a/scalaz-stream_2.11-0.7a.jar
[warn] ==== LocalIvy: tried
[warn]   /home/vagrant/.ivy2/local/org.scalaz.stream/scalaz-stream_2.11/0.7a/bundles/scalaz-stream_2.11.jar
[warn] ==== scalaz-mulesoft: tried
[warn]  https://repository.mulesoft.org/nexus/content/repositories/public/org/scalaz/stream/scalaz-stream_2.11/0.7a/scalaz-stream_2.11-0.7a.jar
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::              FAILED DOWNLOADS            ::
[warn]  :: ^ see resolution messages for details  ^ ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scalaz.stream#scalaz-stream_2.11;0.7a!scalaz-stream_2.11.jar(bundle)
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Wrote /vagrant/dummy-services/target/scala-2.11/dummy-services_2.11-1.1.1.pom
sbt.ResolveException: download failed: org.scalaz.stream#scalaz-stream_2.11;0.7a!scalaz-stream_2.11.jar(bundle)
        at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
        ...
        at java.lang.Thread.run(Thread.java:748)
[error] (akka-quartz/*:update) sbt.ResolveException: download failed: org.scalaz.stream#scalaz-stream_2.11;0.7a!scalaz-stream_2.11.jar(bundle)
[error] Total time: 7 s, completed Jun 3, 2021 1:38:01 PM

CodePudding user response:

see @mpilquist tweet

https://twitter.com/mpilquist/status/1389586284243476484

The early versions of scalaz-stream were published on bintray, which is no longer in service as of May 1st. Try upgrading to 0.7.3a which is on Maven Central (published August 2015). Alternatively, upgrade to fs2 3.0.x :)

CodePudding user response:

If you don't have any reference to scalaz-stream in your code, that means it comes from another dependency transitively.

You have several options here:

  • add a dependency to a different version of scalaz-stream in your dependencies, this should override the version brought transitively. (Not really a best practice)
  • find out which dependency needs scalaz-stream by using sbt dependencyBrowseTree for instance. Then check if this dependency canot be updated itself.
  • you could also define a dependencyOverrides instead of 1st option

Anyway don't use a version with snapshot, it's likely not a stable version, thus not to be used.

  • Related