I am trying to add embedded-kafka to my gradle dependencies.
- The build passes, but running a test which uses
with EmbeddedKafkagives the following error:
Symbol 'type org.apache.zookeeper.server.ServerCnxnFactory' is missing from the classpath.
This symbol is required by 'method io.github.embeddedkafka.ops.ZooKeeperOps.startZooKeeper'.
Make sure that type ServerCnxnFactory is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'ZooKeeperOps.class' was compiled against an incompatible version of org.apache.zookeeper.server.
- Also, any inputs on what's wrong with the following command?
gradle dependencyInsight --configuration testImplementation --dependency embedded-kafkaIt gives this error:configuration 'testImplementation' not found in configuration container.But printing the "configurations" makes it look like testImplementation is present in configs (printing all configurations prints outtestImplementation(usingconfigurations.each { println it.name }))
Here's a super simplified version of my build.gradle file:
plugins {
id 'com.company.scala-common-conventions'
...
}
dependencies {
testImplementation "io.github.embeddedkafka:embedded-kafka_${scalaVersion}:${embeddedKafkaVersion}" //_2.13:3.5.0
}
Folder structure:
big-mono-repo/
|
|_team/
|_component/
|_src/
|_main/
|_test/
|_scala/
| |_com.company.foo.bar
| |_KafkaEventPublisherSpec // uses `withEmebeddedKafka`
|_settings.gradle // copied from the big-mono-repo level for now
|_build.gradle. //the one where I declare embedded-kafka dependency
...
|_build.gradle
|_settings.gradle
Questions:
- Any inputs on how to debug this and get the test to run?
- How to check what is causing the gradle failure/ dependency conflict
- Any alternatives to embedded-kafka for simple tests? (I want to test a Producer and some custom Serializer/Deserializers)