如果你执行过mvn test 或者执行其他maven命令时跑了测试用例,你就已经用过maven-surefire-plugin 了。maven-surefire-plugin 是maven里执行测试用例的插件,不显示配置就会用默认配置。

这个插件的surefire:test 命令会默认绑定maven执行的test 阶段。

我们可以在插件中添加配置:

<argLine>-noverify</argLine>

如果下面的配置:

<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.20</version>
                    <configuration>
                        <argLine>-noverify</argLine>
                        <systemPropertyVariables>
                            <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
                            <forkedProcessTimeoutInSeconds>3600</forkedProcessTimeoutInSeconds>
                            <java.awt.headless>true</java.awt.headless>
                        </systemPropertyVariables>
                        <trimStackTrace>false</trimStackTrace>
                        <skipTests>true</skipTests>
                    </configuration>
                </plugin>

 

Surfire 单元测试添加 jvm参数_测试用例

 

可以在上面的配置参数位置设置命令行参数。

https://www.ossez.com/t/surfire-jvm/14360