8

How to use akka in Scala 3 ? I can't find akka dependencies while using scala 3

sbt errors :

[error]   not found: /Users/admin/.ivy2/localcom.typesafe.akka/akka-actor-typed_3/2.6.15/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/typesafe/akka/akka-actor-typed_3/2.6.15/akka-actor-typed_3-2.6.15.pom
[error] (ssExtractDependencies) sbt.librarymanagement.ResolveException: Error downloading com.typesafe.akka:akka-actor-typed_3:2.6.15
[error]   Not found
[error]   Not found
[error]   not found: /Users/admin/.ivy2/localcom.typesafe.akka/akka-actor-typed_3/2.6.15/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/typesafe/akka/akka-actor-typed_3/2.6.15/akka-actor-typed_3-2.6.15.pom
Spyros K
  • 2,480
  • 1
  • 20
  • 37
Ji Shuai
  • 101
  • 1
  • 2

2 Answers2

11

akka-actor-typed is published for Scala 2.12, 2.13, not for Scala 3

https://mvnrepository.com/artifact/com.typesafe.akka/akka-actor-typed

Try compatibility mode

lazy val foo = project.in(file("foo"))
  .settings(
    scalaVersion := "3.0.0",
    libraryDependencies += 
      ("com.typesafe.akka" %% "akka-actor-typed" % "2.6.15")
        .cross(CrossVersion.for3Use2_13)
  )

https://docs.scala-lang.org/scala3/guides/migration/compatibility-classpath.html


Update. akka-actor-typed is published for Scala 3 since version 2.6.17

libraryDependencies += "com.typesafe.akka" %% "akka-actor-typed" % "2.6.17"
Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66
  • 1
    Note that I would not be 100% confident with compatibility mode on such a critical dependency though. But I may be pessimistic :) – Gaël J Jul 28 '21 at 17:44
  • 2
    @GaëlJ A quote from the link: "Scala 3 compiler is able to read the Scala 2.13 Pickle format and thus it can type check code that depends on modules or libraries compiled with Scala 2.13. The Scala 3 unpickler has been extensively tested in the community build for many years now. It is safe to use." – Dmytro Mitin Jul 29 '21 at 07:05
  • 2
    Sure, I mean if it compiles it's probably fine. I was worried about macros stuff (that maybe Akka don't use at all, IDK) – Gaël J Jul 29 '21 at 07:10
  • 3
    Scala 3 for akka-actor-typed is since oktober 2021 available – ielkhalloufi Nov 18 '21 at 10:35
1

In order to use akka with Scala 3 e.g. the akka-actor-typed you can include akka-actor-typed 2.6.18 as a dependency.

The example provided uses akka-actor-typed 2.6.15 whose target is scala 2.13 and 2.12.
Scala 3 is included as a target only since akka-actor-typed 2.6.17.

The latest version of akka-actor-typed where scala 3 is included as a target is akka-actor-typed 2.6.18.

Spyros K
  • 2,480
  • 1
  • 20
  • 37