Protoquill and zio-http conflict

Hello,
I’m trying to set up a project using both zio-http and quill with scala 3.
I have this build.sbt file:

lazy val root = project
  .in(file("."))
  .settings(
    name := "sandbox",
    version := "0.1.0",

    scalaVersion := "3.0.2",

    libraryDependencies ++= Seq(
      "dev.zio"     %% "zio"             % "2.0.0-M2",
      "io.d11"      %% "zhttp"           % "1.0.0.0-RC17",
      "io.getquill" %% "quill-zio"       % "3.10.0.Beta1.5"
    )
)

If I leave out either “zhttp” or “quill-zio” I can compile with no errors, but when both are added as dependencies I get a conflict like this:

[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef(uri("file:/home/victor/workspace/sandbox/"), "root"):
[error]    org.scala-lang.modules:scala-collection-compat _3, _2.13
[error] stack trace is suppressed; run last update for the full output
[error] (update) Conflicting cross-version suffixes in: org.scala-lang.modules:scala-collection-compat
[error] Total time: 0 s, completed 17 sep. 2021 19:27:59

I tried adding exclude (“org.scala-lang.modules”, “scala-collection-compat”) and with previous versions of both libraries with no luck.
Any tips on how to deal with this kind of conflict?
Thanks

1 Like

You can exclude the 2.13 scala-collection-compat like this:

    excludeDependencies += "org.scala-lang.modules" % "scala-collection-compat_2.13"

Be warned that while this is safe for scala-collection-compat because it does almost nothing in scala >= 2.13 (and probably shouldn’t have been published for scala 3 at all to avoid this sort of conflicts), this is not safe in general for _2.13/_3 conflicts because the artifacts might not be binary-compatible, the only safe thing to do is for all projects to align their dependencies.

1 Like

Isn’t it a pretty bad idea for libraries to depend on 2.13 releases when publishing for 3?

Thanks @smarter I’ll take into account your warning.

Thanks @smarter for providing the right answer here.
I will publish quill-core/sql-portable for Scala 3 directly on the next release to remove this issue.

I was struggling with zio-hhtp and coralogix/zio-k8s with same error. This solution helped. Thanks!