zio / zio-kafka

A Kafka client for ZIO and ZIO Streams
https://zio.dev/zio-kafka
Apache License 2.0
334 stars 133 forks source link

Possible to use a Scala 3 version of embedded-kafka? #1193

Open bbarker opened 3 months ago

bbarker commented 3 months ago

When we try to use https://github.com/embeddedkafka/embedded-kafka-schema-registry in our project, we get a conflict:

[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef(uri("file:/home/me/WH/xyz/"), "foo"):
[error]    io.github.embeddedkafka:embedded-kafka _2.13, _3
[error] Couldn't run bloopGenerate. The issue could be caused by failing to compile the project.
[warn] Removed stale /home/me/WH/xyz/.bloop/foo-test.json

It seems that zio-kafka is pulling in the 2.13 version of embedded kafka for the Scala 3 build; not sure if there's a way around this.

Here's how we're pulling in both deps:

lazy val zioKafkaTestKit          = zio                                   %% "zio-kafka-testkit"                   % "2.7.3"     % Test
lazy val embeddedkafkaSchemaReg   = "io.github.embeddedkafka"             %% "embedded-kafka-schema-registry"      % "7.6.0"     % Test
erikvanoosten commented 3 months ago

Duplicate of #1035.

With some time and love this problem might be solvable. More documentation about this is available on https://docs.scala-lang.org/scala3/guides/migration/compatibility-classpath.html

If needed, we will definitely accept pull requests that fix this.

bbarker commented 3 months ago

Fortunately, for now, we have a workaround:

  lazy val embeddedkafkaSchemaReg = ("io.github.embeddedkafka" %% "embedded-kafka-schema-registry" % confluentKafkaV % Test)
    .cross(CrossVersion.for3Use2_13) exclude ("org.scala-lang.modules", "scala-collection-compat_2.13")

Also posted in the other issue.