scalasbtakka

How to resolve Akka Library Dependency Error


I'm trying to setup an API using Scala and found some online resources suggesting akka. I'm new to Scala, so I'm following some documentation and also checked out https://doc.akka.io/docs/akka/current/typed/actors.html for official docs and versions. I've got that setup in my build.sbt with the rest of my library dependencies below:

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion,
)

When I try to run sbt run I get an error sbt.librarymanagement.ResolveException: Error downloading com.typesafe.akka:akka-actor-typed_3:2.9.7. I've verified that the packages and versions exist here: https://doc.akka.io/docs/akka/current/typed/actors.html. I'm wondering if something about my setup or configuration is incorrect.

Any assistance on how to resolve this would be much appreciated! The full error log is below for reference:

Note: Unresolved dependencies path:
[error] sbt.librarymanagement.ResolveException: Error downloading com.typesafe.akka:akka-actor-typed_3:2.9.7
[error]   Not found
[error]   Not found
[error]   not found: /Users/env/.ivy2/localcom.typesafe.akka/akka-actor-typed_3/2.9.7/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/typesafe/akka/akka-actor-typed_3/2.9.7/akka-actor-typed_3-2.9.7.pom
[error]         at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:346)
[error]         at lmcoursier.CoursierDependencyResolution.$anonfun$update$39(CoursierDependencyResolution.scala:315)
[error]         at scala.util.Either$LeftProjection.map(Either.scala:573)
[error]         at lmcoursier.CoursierDependencyResolution.update(CoursierDependencyResolution.scala:315)
[error]         at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:60)
[error]         at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:60)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:142)
[error]         at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:74)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:144)
[error]         at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:131)
[error]         at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:220)
[error]         at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:169)
[error]         at sbt.Classpaths$.$anonfun$updateTask0$1(Defaults.scala:3894)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]         at sbt.Execute.work(Execute.scala:292)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error]         at java.base/java.lang.Thread.run(Thread.java:1575)
[error] (update) sbt.librarymanagement.ResolveException: Error downloading com.typesafe.akka:akka-actor-typed_3:2.9.7
[error]   Not found
[error]   Not found
[error]   not found: /Users/env/.ivy2/localcom.typesafe.akka/akka-actor-typed_3/2.9.7/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/typesafe/akka/akka-actor-typed_3/2.9.7/akka-actor-typed_3-2.9.7.pom
[error] Total time: 1 s, completed Oct 23, 2024, 3:02:16 p.m.

Solution

  • As it is detailed in Akka - Introduction to Actors (the same link you shared)

    Module Info

    The Akka dependencies are available from Akka’s library repository. To access them there, you need to configure the URL for this repository.

    resolvers += "Akka library repository".at("https://repo.akka.io/maven")
    

    Based on the build.sbt config you shared, that line is missing