From 003c4280a46b30a370d286d5130fb3c4f54a0372 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 23 Jan 2025 16:53:00 +0100 Subject: [PATCH] GH-1034 - Prevent dynamic agent attachment warnings caused by Mockito. Prior to this commit, running our tests caused the following warning because Mockito was dynamically self-attaching to the running JVM: Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build what is described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.3 We now follow the advice in the provided link and set up our build accordingly. --- pom.xml | 14 ++++++++++++++ spring-modulith-apt/pom.xml | 6 ++++++ spring-modulith-examples/pom.xml | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/pom.xml b/pom.xml index bc79beac..70498cef 100644 --- a/pom.xml +++ b/pom.xml @@ -551,6 +551,18 @@ limitations under the License. + + org.apache.maven.plugins + maven-dependency-plugin + + + + properties + + + + + org.apache.maven.plugins maven-surefire-plugin @@ -558,6 +570,8 @@ limitations under the License. + + -javaagent:${org.mockito:mockito-core:jar} diff --git a/spring-modulith-apt/pom.xml b/spring-modulith-apt/pom.xml index 78313316..4246489c 100644 --- a/spring-modulith-apt/pom.xml +++ b/spring-modulith-apt/pom.xml @@ -63,6 +63,12 @@ test + + org.mockito + mockito-core + test + + diff --git a/spring-modulith-examples/pom.xml b/spring-modulith-examples/pom.xml index 9e4bd7c5..b1e2f244 100644 --- a/spring-modulith-examples/pom.xml +++ b/spring-modulith-examples/pom.xml @@ -93,6 +93,25 @@ + + org.apache.maven.plugins + maven-dependency-plugin + + + + properties + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + -javaagent:${org.mockito:mockito-core:jar} + +