SBT can't resolve dependency that exists on Sonatype repo
Asked Answered
G

2

6

I'm attempting to include a dependency known as uimascala in my project. It's available on the Sonatype repository, but for some reason SBT won't can't find it. Here's my build.sbt.

val sparkCore = "org.apache.spark" % "spark-core_2.10" % "1.2.0"
val uimaScala = "com.github.jenshaase.uimascala" % "uimascala-core_2.10" % "0.5.0-SNAPSHOT"

// test deps
val specs2 = "org.specs2" %% "specs2-core" % "2.4.15" % "test"

lazy val commonSettings = Seq(
  organization := "foo",
  version := "0.1.0",
  scalaVersion := "2.10.4"
)

lazy val `twitter-sentiment-stream` = (project in file(".")).
  settings(commonSettings: _*).
  settings(
    name := "bar",
    resolvers ++= Seq(
      //"Sonatype OSS Releases"  at "http://oss.sonatype.org/content/repositories/releases/",
      "Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
    ),
    libraryDependencies ++= Seq(sparkCore, uimaScala, specs2)
  )

addCompilerPlugin("org.scalamacros" % "paradise" % "2.0.1" cross CrossVersion.full)

When I attempt to build the project I get the following error in my output, but when I check the URL that it attempted it's valid.

[warn] ==== Sonatype OSS Snapshots: tried
[warn]   http://oss.sonatype.org/content/repositories/snapshots/com/github/jenshaase/uimascala/uimascala-core_2.10/0.5.0-SNAPSHOT/uimascala-core_2.10-0.5.0-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.github.jenshaase.uimascala#uimascala-core_2.10;0.5.0-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: com.github.jenshaase.uimascala#uimascala-core_2.10;0.5.0-SNAPSHOT: not found
Greening answered 10/2, 2015 at 3:8 Comment(0)
L
13

I suspect the hand-typed resolver URL. I was able to resolve your libraries with the following change using sbt 0.13.7:

resolvers ++= Seq(
  Resolver.sonatypeRepo("public"),
  Resolver.bintrayRepo("scalaz", "releases")
)

Maybe https is now required.

Levesque answered 10/2, 2015 at 3:25 Comment(1)
That works. Thank you. I wasn't aware of these Resolver "shortcuts" (for lack of a better term). I should note that I when I tried using https for the sonatype resolvers I manually entered it worked as well.Greening
S
5

For a even shorter version, you can use Opts.resolver.sonatypeSnapshots instead of your custom resolver.

Saltine answered 10/2, 2015 at 15:50 Comment(1)
Opts.resolver.sonatypeOssSnapshots now (Opts.resolver.sonatypeSnapshots is deprecated since 1.7.0)Tall

© 2022 - 2024 — McMap. All rights reserved.