Skip to content

Commit 3ed32e2

Browse files
authored
build: upgrade byte-buddy to fix issue with JDK 21 (#56)
Mockito was failing to mock some classes, outputting things like: ``` Mockito cannot mock this class: class org.apache.kafka.clients.consumer.KafkaConsumer. [...] Underlying exception : org.mockito.exceptions.base.MockitoException: Could not modify all classes [...] ``` This commit only loads the Byte Buddy agent instead of whitelisting all potential agents (which is the most visible answer but a flawed one).
1 parent bf2e1c4 commit 3ed32e2

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

common/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@
9191
</resource>
9292
</resources>
9393
<plugins>
94+
<plugin>
95+
<groupId>org.apache.maven.plugins</groupId>
96+
<artifactId>maven-surefire-plugin</artifactId>
97+
<configuration>
98+
<argLine>-javaagent:${net.bytebuddy:byte-buddy-agent:jar}</argLine>
99+
</configuration>
100+
</plugin>
94101
<plugin>
95102
<groupId>org.jetbrains.kotlin</groupId>
96103
<artifactId>kotlin-maven-plugin</artifactId>

pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@
154154
<artifactId>kotest-assertions-core-jvm</artifactId>
155155
<version>${kotest-assertions-core-jvm.version}</version>
156156
</dependency>
157+
<dependency>
158+
<groupId>net.bytebuddy</groupId>
159+
<artifactId>byte-buddy</artifactId>
160+
<version>1.14.11</version>
161+
</dependency>
157162
<dependency>
158163
<groupId>org.apache.avro</groupId>
159164
<artifactId>avro</artifactId>
@@ -343,6 +348,19 @@
343348
</execution>
344349
</executions>
345350
</plugin>
351+
<plugin>
352+
<groupId>org.apache.maven.plugins</groupId>
353+
<artifactId>maven-dependency-plugin</artifactId>
354+
<version>3.6.1</version>
355+
<executions>
356+
<execution>
357+
<id>dependency-paths-as-properties</id>
358+
<goals>
359+
<goal>properties</goal>
360+
</goals>
361+
</execution>
362+
</executions>
363+
</plugin>
346364
<plugin>
347365
<groupId>org.apache.maven.plugins</groupId>
348366
<artifactId>maven-surefire-plugin</artifactId>

sink/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@
6666
</dependencies>
6767
<build>
6868
<plugins>
69+
<plugin>
70+
<groupId>org.apache.maven.plugins</groupId>
71+
<artifactId>maven-surefire-plugin</artifactId>
72+
<configuration>
73+
<argLine>-javaagent:${net.bytebuddy:byte-buddy-agent:jar}</argLine>
74+
</configuration>
75+
</plugin>
6976
<plugin>
7077
<groupId>org.jetbrains.kotlin</groupId>
7178
<artifactId>kotlin-maven-plugin</artifactId>

source/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@
9393
</dependencies>
9494
<build>
9595
<plugins>
96+
<plugin>
97+
<groupId>org.apache.maven.plugins</groupId>
98+
<artifactId>maven-surefire-plugin</artifactId>
99+
<configuration>
100+
<argLine>-javaagent:${net.bytebuddy:byte-buddy-agent:jar}</argLine>
101+
</configuration>
102+
</plugin>
96103
<plugin>
97104
<groupId>org.jetbrains.kotlin</groupId>
98105
<artifactId>kotlin-maven-plugin</artifactId>

testing/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@
9292
</dependencies>
9393
<build>
9494
<plugins>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-surefire-plugin</artifactId>
98+
<configuration>
99+
<argLine>-javaagent:${net.bytebuddy:byte-buddy-agent:jar}</argLine>
100+
</configuration>
101+
</plugin>
95102
<plugin>
96103
<groupId>org.jetbrains.kotlin</groupId>
97104
<artifactId>kotlin-maven-plugin</artifactId>

0 commit comments

Comments
 (0)