解决Mockito警告:Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK.

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

根据 Mockito 的文档,在Maven构建配置中添加插件。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.5.2</version>
    <configuration>
        <argLine>-javaagent:"${settings.localRepository}/org/mockito/mockito-core/5.14.2/mockito-core-5.14.2.jar"</argLine>
    </configuration>
</plugin>

posted @ 2025-01-03 10:04  mmcol  阅读(3192)  评论(1)    收藏  举报