SpringBoot项目启动报错:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project xxxService: There are test failures.

Please refer to xxxService\target\surefire-reports for the individual test results.

这个报错原因是因为项目启动,编译程序,maven在执行项目中的单元测试时,单元测试未通过,所以程序启动就停止了。

如何解决呢?有两种方法
方法一:在pom文件中添加插件配置

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <testFailureIgnore>true</testFailureIgnore>
    </configuration>
</plugin>

方法二:idea运行项目时忽略
idea编辑器右侧的maven窗口中,点击选中“Toggle Skip Tests Mode”即可跳过执行单元测试了。