alpakka icon indicating copy to clipboard operation
alpakka copied to clipboard

Scala 3 build artifacts

Open AndreasPresthammer opened this issue 2 years ago • 10 comments

What are the plans for providing Scala 3 build artifacts? Would be greatly appreciated to allow easier Scala 3 upgrades for Akka projects without getting into dependency versioning problems.

AndreasPresthammer avatar Nov 22 '21 07:11 AndreasPresthammer

Akka itself has just been published as a milestone including Scala 3 artefacts. See https://github.com/akka/akka/issues/30243#issuecomment-973957683

The next major Alpakka release will drop Scala 2.12 https://github.com/akka/alpakka/pull/2777, so there is room for the community to step in and propose changes for publishing Scala 3 artefacts.

ennru avatar Nov 23 '21 08:11 ennru

Would it be possible to use Alpakka 2.13 artefacts with Scala 3?

I tried using cross-compile but that gave me weird dependency resolution errors

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % AkkaVersion,
  "com.typesafe.akka" %% "akka-stream-typed" % AkkaVersion,
  "com.typesafe.akka" %% "akka-stream" % AkkaVersion,
  "com.typesafe.akka" %% "akka-stream-testkit" % AkkaVersion % Test,
  ("com.typesafe.akka" %% "akka-stream-kafka" % AlpakkaKafkaVersion).cross(CrossVersion.for3Use2_13),
  ("com.lightbend.akka" %% "akka-stream-alpakka-s3" % AlpakkaVersion).cross(CrossVersion.for3Use2_13),
  ("com.lightbend.akka" %% "akka-stream-alpakka-slick" % AlpakkaVersion).cross(CrossVersion.for3Use2_13)
)
[error] (update) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[error] 
[error]         * org.scala-lang.modules:scala-java8-compat_2.13:1.0.0 (early-semver) is selected over 0.9.0
[error]             +- com.typesafe.akka:akka-actor_3:2.6.17              (depends on 1.0.0)
[error]             +- com.typesafe.akka:akka-actor_2.13:2.6.15           (depends on 0.9.0)

Though, I must admit I never used sbt so this might be totally wrong anyways

lostiniceland avatar Nov 24 '21 12:11 lostiniceland

I tried the same as @lostiniceland and got into exactly the same trouble, and that is where I stopped. Perhaps it could be made to work, but it made me uncomfortable.

AndreasPresthammer avatar Nov 24 '21 12:11 AndreasPresthammer

It seems that Alpakka refers to Akka 2.6.15 which causes this issue. When I try to override the transitive dependency like so

dependencyOverrides += "com.typesafe.akka" % "akka-actor_2.13" % AkkaVersion // where version is 2.6.17

It crashes with another cross-failure.

[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef(uri("file:/home/marc/Development/projects/akka-streams-demo/"), "akka-streams-demo"):
[error]    com.typesafe.akka:akka-protobuf-v3 _3, _2.13
[error]    com.typesafe.akka:akka-actor _3, _2.13
[error]    com.typesafe.akka:akka-stream _3, _2.13

Maybe it would be enough to release a new 2.13 Alpakka version which updates to Akka 2.6.17 (or whats the latest at the time) to make cross-compile work and give the community enough time to figure out a proper Scala 3 release. Though I am not sure.

lostiniceland avatar Nov 24 '21 18:11 lostiniceland

I played around with the depencies and built a local version but the problem remained. The only way to resolve the issue, was to use 2.13 Akka/Akka-Streams/Alpakka dependencies.

@ennru I see you are working on some changes. Would it make sense to push to a dedicated scala-3 branch and start a epic with the necessary changes/issues for it (I guess the biggest challenge will be keeping the source compatible with 2.13 and 3 without introducing maintenance cost)? I would be willing to help but I might need some guidance.

lostiniceland avatar Dec 01 '21 16:12 lostiniceland

I just released Alpakka 3.0.4 to get the new connectors and minor additions out.

My thinking is that we should gear up for Alpakka 4 in the main branch and I suggest we ditch Scala 2.12 support as I try in https://github.com/akka/alpakka/pull/2777. That should make it much easier to even publish for Scala 3.

Akka's snapshots are now cross-built even with Scala 3. Most likely the next Akka release will be published for Scala 2.12, 2.13 and 3.1.

ennru avatar Dec 02 '21 15:12 ennru

Any news on this topic? I tried to find the cross-compiled snapshots without success in the maven-central-snapshots repo. Is it on some other repo?

lostiniceland avatar Mar 10 '22 18:03 lostiniceland

Akka HTTP is closing in on Scala 3 cross builds, see https://github.com/akka/akka-http/issues/3891

We have some use of Akka gRPC, which is not published for Scala 3, yet. I guess excluding those modules would be OK. See https://github.com/akka/akka-grpc/issues/1407 First Akka gRPC 2.0 upgrade attempt in https://github.com/akka/alpakka/pull/2678

We've dropped Scala 2.12 from Alpakka now so we have room for Scala 3 tweaks if needed.

ennru avatar Mar 11 '22 10:03 ennru

Hello @ennru , is someone working on this on your side or is it worth having a go? we are basically trying to move to scala 3 and stumbled upon this.

I can spend a few days if it's not already in progress on your side? I can see progress in the 4.0.0 milestone but maybe there's something I can also help with

vaslabs avatar Jul 18 '22 14:07 vaslabs

I'm not aware of others working on Scala 3 builds for Alpakka. Please give it a go!

ennru avatar Jul 23 '22 20:07 ennru

We're now publishing Scala 3 artefacts for both Akka and Akka HTTP (snapshots so far). Many Alpakka modules should compile with Scala 3, as well.

ennru avatar Nov 16 '22 12:11 ennru

A few of Alpakka's connectors are published even for Scala 3 since a while ago. JMS is joining the club with the next release. Closing this issue.

ennru avatar Sep 04 '23 14:09 ennru