Add Mockito Java agent to Maven Surefire plugin
MSALMockito attaches its Byte Buddy agent to the running JVM at test time, which the JDK has warned about since Java 21 and intends to disallow. This recipe instead loads the agent up front through the Maven Surefire plugin, adding the maven-dependency-plugin properties goal to resolve the agent jar path, to silence the warning and stay ahead of the JDK change.
org. openrewrite. java. migrate. AddMockitoJavaAgentToMavenSurefirePluginmod run . --recipe= org. openrewrite. java. migrate. AddMockitoJavaAgentToMavenSurefirePluginInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.