|
3 | 3 |
|
4 | 4 | When you use `spring-kafka-test` (version 2.2.x) with the 2.1.x `kafka-clients` jar, you need to override certain transitive dependencies, as follows: |
5 | 5 |
|
| 6 | +**maven** |
| 7 | + |
6 | 8 | ==== |
7 | | -[source, xml] |
| 9 | +[source, xml, subs="+attributes"] |
8 | 10 | ---- |
9 | 11 | <dependency> |
10 | 12 | <groupId>org.springframework.kafka</groupId> |
11 | 13 | <artifactId>spring-kafka</artifactId> |
12 | | - <version>${spring.kafka.version}</version> |
| 14 | + <version>{project-version}</version> |
13 | 15 | </dependency> |
14 | 16 |
|
15 | 17 | <dependency> |
16 | 18 | <groupId>org.springframework.kafka</groupId> |
17 | 19 | <artifactId>spring-kafka-test</artifactId> |
18 | | - <version>${spring.kafka.version}</version> |
| 20 | + <version>{project-version}</version> |
19 | 21 | <exclusions> |
20 | 22 | <exclusion> |
21 | 23 | <groupId>org.apache.kafka</groupId> |
@@ -54,6 +56,28 @@ When you use `spring-kafka-test` (version 2.2.x) with the 2.1.x `kafka-clients` |
54 | 56 | </dependency> |
55 | 57 | ---- |
56 | 58 | ==== |
| 59 | + |
| 60 | +**gradle** |
| 61 | + |
| 62 | +==== |
| 63 | +[source, groovy, subs="+attributes"] |
| 64 | +---- |
| 65 | +dependencies { |
| 66 | +
|
| 67 | + implementation 'org.springframework.kafka:spring-kafka:{project-version}' |
| 68 | +
|
| 69 | + implementation 'org.apache.kafka:kafka-clients:2.1.1' |
| 70 | + testImplementation ('org.springframework.kafka:spring-kafka-test:{project-version}') { |
| 71 | + exclude module: 'kafka_2.11' |
| 72 | + } |
| 73 | + testImplementation 'org.apache.kafka:kafka-clients:2.1.1:test' |
| 74 | + testImplementation 'org.apache.kafka:kafka_2.12:2.1.1' |
| 75 | + testImplementation 'org.apache.kafka:kafka_2.12:2.1.1:test' |
| 76 | +
|
| 77 | +} |
| 78 | +---- |
| 79 | +==== |
| 80 | + |
57 | 81 | Note that when switching to scala 2.12 (recommended for 2.1.x and higher), the 2.11 version must be excluded from spring-kafka-test. |
58 | 82 |
|
59 | 83 | [appendix] |
|
0 commit comments