4

When I use sbt the error message appears as below:

==== public: tried
[warn]   https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11/scala-library-2.11.pom
[warn] ==== bintray-spark-jobserver-maven: tried
[warn]   https://dl.bintray.com/spark-jobserver/maven/org/scala-lang/scala-library/2.11/scala-library-2.11.pom
[warn] ==== Typesafe Repo: tried
[warn]   http://repo.typesafe.com/typesafe/releases/org/scala-lang/scala-library/2.11/scala-library-2.11.pom

It seems the "https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11/scala-library-2.11.pom" could not be found, and I check the page also does not exist.

It also causes the scala-library-2.11 jar to not be found.

On the other hand, when I check https://repo1.maven.org/maven2/org/scala-lang/scala-library/**2.11.0**/scala-library-**2.11.0**.pom this url exists.

How can I resolve this?

RyanQuey
  • 705
  • 1
  • 9
  • 29
Frank Yao
  • 41
  • 1
  • 2
  • Show your `build.sbt` please – Evgeny Feb 28 '18 at 08:08
  • 3
    Yup, `build.sbt` would help, probably small detail like `scalaVersion := "2.11"` instead of `scalaVersion := "2.11.0"`, but without the code it is hard to tell. – Mateusz Kubuszok Feb 28 '18 at 17:14
  • Is this resolved, I am facing the same issue. If I put it as 2.11 it is causing issue in downloading scala-library but if I put it as 2.11.0 it is causing issue for other transitive dependent libraries like json4s etc. – amandeep1991 Jul 08 '19 at 07:18

3 Answers3

2

I had the same exact problem, I eventually figured that there isn't a 2.11 version of scala, and that it isn't equivalent to the 2.11.0 version, check all scala versions available in this link

so the steps to fix this are:

  1. Change the version into another valid version (2.11.0 for example)
  2. delete your ~/.ivy2 directory just to make sure you're starting clean and avoid binary conflicts(you can skip this step)
  3. re-build your project

and it should work perfectly!

Rama Salahat
  • 182
  • 12
0

You need to change your scala version to 2.11.12 (or whatever minor version you want, but you need to specify all three parts, as in 2.11.12 or 2.11.8 etc).

How to Change Your Scala Version

There are two ways you can do this.

  1. You can do this from build.sbt directly by putting this in your file:
ThisBuild / scalaVersion := "2.11.12"
  1. You can also do this from the sbt console.

Open the sbt console:

sbt

Wait for it to start up, then set the version in the console by running the following:

sbt:my-project> ThisBuild / scalaVersion := "2.11.12"

This sets the version in the console but will not persist beyond this console session. To save this setting, run:

sbt:my-project> session save

This will save it to your build.sbt file for you.

Note: if you don't want to set the scalaVersion for all subprojects as well, don't scope the scalaVersion to ThisBuild; see here for details.

Update your packages

Now you can update your packages by running:

sbt:my-project> update

You should see something like:

[success] Total time: 0 s, completed Jul 10, 2020 5:19:31 AM
RyanQuey
  • 705
  • 1
  • 9
  • 29
0

I also faced this issue. Earlier, I was trying to shift burden to runtime to provide the dependency - but that's dodging the problem.

Finally, the issue was a transitive dependency relying on scalaVersion (or Scala.version) property specified in my project pom or sbt file.

After changing that to my expectations (2.11.8 specifically), things worked like charm.

CSLf
  • 31
  • 2