From f6dd7836c231e6b03bf701237952c96efbafc756 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 23 Jan 2025 16:53:00 +0100 Subject: [PATCH] GH-1033 - 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 85a1c4ec..4c0766f3 100644 --- a/pom.xml +++ b/pom.xml @@ -562,6 +562,18 @@ limitations under the License. + + org.apache.maven.plugins + maven-dependency-plugin + + + + properties + + + + + org.apache.maven.plugins maven-surefire-plugin @@ -569,6 +581,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 89bc4089..ddb4d81e 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 6e803bf6..adbbd5a9 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} + +