Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library not compatible with Scala 3 #280

Closed
Maurycy-Sokolowski opened this issue Jul 30, 2023 · 3 comments
Closed

Library not compatible with Scala 3 #280

Maurycy-Sokolowski opened this issue Jul 30, 2023 · 3 comments

Comments

@Maurycy-Sokolowski
Copy link

Maurycy-Sokolowski commented Jul 30, 2023

Scala 3.2.2 and everything goes fine without "ch.megard" %% "akka-http-cors" % "1.2.0".

When I do below:

libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor-typed" % "2.8.3",
"com.typesafe.akka" %% "akka-stream" % "2.8.3",
"com.typesafe.akka" %% "akka-http" % "10.5.2",
"ch.megard" % "akka-http-cors_3" % "1.2.0",
...

I get:

Modules were resolved with conflicting cross-version suffixes in ...

[error] com.typesafe.akka:akka-http-core _3, _2.13
[error] com.typesafe.akka:akka-parsing _3, _2.13
[error] com.typesafe.akka:akka-http _3, _2.13
[error] java.lang.RuntimeException: Conflicting cross-version suffixes in: com.typesafe.akka:akka-http-core, com.typesafe.akka:akka-parsing, com.typesafe.akka:akka-http
[error] at scala.sys.package$.error(package.scala:30)
[error] at sbt.librarymanagement.ConflictWarning$.processCrossVersioned(ConflictWarning.scala:39)
[error] at sbt.librarymanagement.ConflictWarning$.apply(ConflictWarning.scala:19)
[error] at sbt.Classpaths$.$anonfun$ivyBaseSettings$71(Defaults.scala:3203)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] at sbt.Execute.work(Execute.scala:291)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error] at java.base/java.lang.Thread.run(Thread.java:832)
[error] (update) Conflicting cross-version suffixes in: com.typesafe.akka:akka-http-core, com.typesafe.akka:akka-parsing, com.typesafe.akka:akka-http

I tried every variation out there including:

"ch.megard" %% "akka-http-cors" % "1.2.0",

and

"ch.megard" % "akka-http-cors_2_13" % "1.2.0",

Still the same error.

@Maurycy-Sokolowski
Copy link
Author

Maurycy-Sokolowski commented Jul 30, 2023

Also I downgraded akka-http to 10.2.10 and still the same error. What is the solution? I imported the whole source of this project and recompiled it in Scala 3 to make it work but rather would import the library.

@lomigmegard
Copy link
Owner

lomigmegard commented Jul 31, 2023

Hi @Maurycy-Sokolowski

Related to #223 , but for now I didn't move the akka version because of the change of license. Thanks to akka binary compatibility the current version works with newer versions of akka and akka-http.

Now for Scala 3 in particular, you can try excluding the transitive dependency, which should resolve the conflict and work as expected:

libraryDependencies += "ch.megard" %% "akka-http-cors" % "1.2.0" excludeAll ExclusionRule(organization = "com.typesafe.akka")

@Maurycy-Sokolowski
Copy link
Author

I can confirm it works! Great fix.

@lomigmegard lomigmegard pinned this issue Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants