Search code examples
scalasbtscalatest

Why is ScalaTest 3.0.1 for 2.12 not resolved?


I have a scala project that is cross built for 2.11 and 2.12

crossScalaVersions := Seq("2.11.8", "2.12.0")

I've added dependency for scalatest.

libraryDependencies ++= Seq(
  "org.scalatest"            %% "scalatest"           % "3.0.1"    % "test",
  "org.mockito"              % "mockito-all"          % "1.10.19"  % "test"
)
resolvers ++= Seq(
  "Akka"       at    "http://akka.io/repository/",
  "Sonatype"   at    "http://oss.sonatype.org/content/repositories/releases"
)

I can see that 2.12 version is published for scalatest from 3.0.0. SBT is not able to resolve it though.

[warn] ==== sbt-releases-repo: tried
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/org.scalatest/scalatest_2.12/3.0.1/ivys/ivy.xml
[warn] ==== sbt-plugins-repo: tried
[warn]   http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scalatest/scalatest_2.12/3.0.1/ivys/ivy.xml
[warn] ==== my-ivy-proxy-releases: tried
[warn]   http://artifactory.internal.com/ivy-releases/org.scalatest/scalatest_2.12/3.0.1/ivys/ivy.xml
[warn] ==== my-maven-proxy-releases: tried
[warn]   http://artifactory.internal.com/maven-releases/org/scalatest/scalatest_2.12/3.0.1/scalatest_2.12-3.0.1.pom [warn] ==== Akka: tried
[warn]   http://akka.io/repository/org/scalatest/scalatest_2.12/3.0.1/scalatest_2.12-3.0.1.pom
[warn] ==== Sonatype: tried
[warn]   http://oss.sonatype.org/content/repositories/releases/org/scalatest/scalatest_2.12/3.0.1/scalatest_2.12-3.0.1.pom [info] Resolving jline#jline;2.14.1 ...

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::      UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scalatest#scalatest_2.12;3.0.1: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

Any pointers to what is missing here?

UPDATE: Adding my ~/.sbt/repositories setting

[repositories]

local  
my-ivy-proxy-releases: http://artifactory.internal.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
my-maven-proxy-releases: http://artifactory.internal.com/maven-releases/

Solution

  • According to your log, SBT doesn't search for the dependency on Maven Central, which is the most straightforward place to get Scalatest from. This is not an issue with a default SBT config (since Maven Central is one of the default resolvers); but here, you have a specific SBT config, to use your organization's internal repos instead (on http://artifactory.internal.com).

    You need to either add Maven Central in your SBT resolvers (but that's probably not what you want, in the long term) or check with your Artifactory admins if the artifactory.internal.com/maven-releases repo is the one that's supposed to proxy Maven Central dependencies, and if it's properly configured. I think they should also be able to export from Artifactory a Maven configuration file pointing to the repos you need to use: you could then just copy and paste the URLs from that to your SBT config file.