4

I am compiling my project with sbt and am getting an UNRESOLVED DEPENDENCIES error.

The fact is that I fetched the example I use (a hello world program) from an online blog, that uses scalaVersion := "2.10.0" as shown below. I am using 2.11.2.

How do I update the library dependencies (in the build.sbt) to the latest version of Scala, specifically the revision part?

build.sbt

name := "Hello Test #1"

version := "1.0"

scalaVersion := "2.10.0"

resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

libraryDependencies += "com.typesafe.akka" % "akka-actor_2.10" % "2.2-M1"

The error:

[info] Resolving com.typesafe.akka#akka-actor_2.11.2;2.2-M1 ...
[warn]  module not found: com.typesafe.akka#akka-actor_2.11.2;2.2-M1
[warn] ==== local: tried
[warn]   /home/plard/.ivy2/local/com.typesafe.akka/akka-actor_2.11.2/2.2-M1/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/com/typesafe/akka/akka-actor_2.11.2/2.2-M1/akka-actor_2.11.2-2.2-M1.pom
[warn] ==== Typesafe Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/com/typesafe/akka/akka-actor_2.11.2/2.2-M1/akka-actor_2.11.2-2.2-M1.pom
[info] Resolving jline#jline;2.12 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.typesafe.akka#akka-actor_2.11.2;2.2-M1: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.akka#akka-actor_2.11.2;2.2-M1: not found
[error] Total time: 1 s, completed Aug 11, 2014 10:32:11 AM

1 Answer 1

10
name := "Hello Test #1"

version := "1.0"

scalaVersion := "2.11.2"

resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.4"

This should do it. Note the %% and no version specified for the Akka artifact. Doing so, SBT will automatically append your Scala version to the artifact. See docs for more details.

2
  • Does this syntax works for any dependency i would like to add to the project? I.e. Is: '%% "name" % "reversion"' functions?
    – wipman
    Aug 11, 2014 at 8:57
  • @wipman Yes, as long as the dependency artifact follow the "name_x.x" convention
    – LMeyer
    Aug 11, 2014 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.