spring-kafka icon indicating copy to clipboard operation
spring-kafka copied to clipboard

kafka test jars are included in spring-kafka-test

Open rob-valor opened this issue 7 months ago • 6 comments
trafficstars

The tests jar of kakfa-clients and kafka-server-commons are included in spring-kafka-test. Both include a junit-platform.properties configuration file which results in WARNING: Discovered 2 'junit-platform.properties' configuration files in the classpath; only the first will be used.

I can't really find any reason why those test jars are included.

rob-valor avatar Mar 26 '25 12:03 rob-valor

This is known issue: https://issues.apache.org/jira/browse/KAFKA-17121.

You can try to exclude those dependencies, but I think somewhere in the KafkaClusterTestKit hierarchy some of those classes are used.

We are right now in 4.0 generation, so we can revise some of those transitive dependencies for a minimum. Might be the case that some of those were used for Zookeeper mode which is not there any more.

artembilan avatar Mar 26 '25 13:03 artembilan

Ya, @artembilan, I was also curious about this issue and was looking. As you said, we can probably remove those dependencies and see what breaks in 4.0.

sobychacko avatar Mar 26 '25 13:03 sobychacko

Well, I see that issue has been fixed in Kafka 3.9.0. You can just upgrade your project to that one: https://docs.spring.io/spring-kafka/reference/appendix/override-boot-dependencies.html

artembilan avatar Mar 26 '25 13:03 artembilan

I just ran our tests with both kafka-clients and kafka-server-common excluded from spring-kafka-test. That also does the job 😁. We run our tests with a Confluent Kafka container 😉

rob-valor avatar Mar 26 '25 14:03 rob-valor

I am confused. If you use Confluent Kafka container then you don't need embedded Kafka at all. And might be the case that you don't need spring-kafka-test altogether. That did a job for you because you don't use an @EmbeddedKafka in your project. Therefore there might not be the pass where a call to those test artifacts would happen.

artembilan avatar Mar 26 '25 14:03 artembilan

I'll check why spring-kafka-test is included in the project 👍

rob-valor avatar Mar 26 '25 15:03 rob-valor

Closing the issue due to no recent activity. Please feel free to re-open if you need to.

sobychacko avatar Aug 25 '25 17:08 sobychacko