From 74f4417cd9d777caea50c4f082fc3efc32def60a Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 23 Jan 2025 16:53:00 +0100 Subject: [PATCH] GH-1035 - 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. $ Conflicts: $ spring-modulith-apt/pom.xml --- pom.xml | 14 ++++++++++++++ spring-modulith-examples/pom.xml | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/pom.xml b/pom.xml index dab98e07..ccf5dc42 100644 --- a/pom.xml +++ b/pom.xml @@ -496,6 +496,18 @@ limitations under the License. + + org.apache.maven.plugins + maven-dependency-plugin + + + + properties + + + + + org.apache.maven.plugins maven-surefire-plugin @@ -504,6 +516,8 @@ limitations under the License. + + -javaagent:${org.mockito:mockito-core:jar} diff --git a/spring-modulith-examples/pom.xml b/spring-modulith-examples/pom.xml index 4b1aa446..4705121c 100644 --- a/spring-modulith-examples/pom.xml +++ b/spring-modulith-examples/pom.xml @@ -50,6 +50,25 @@ + + org.apache.maven.plugins + maven-dependency-plugin + + + + properties + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + -javaagent:${org.mockito:mockito-core:jar} + +