SpringBoot项目打包出错

首先确定项目都能跑通的情况下,在跟项目打包时报错

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

大概意思是测试文件打包失败。

既然失败,那就忽视测试文件。

在测试类中添加给注解@Ignore

@Ignore

在类上添加就是忽视这个类,

在方法上添加就是忽视这个方法。

package cn.itsroce.spring_boot.spring_boot;

import org.junit.Ignore;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
@Ignore
class ApplicationTests {

   @Test
   void contextLoads() {
   }

}

添加好后,再次打包,就ok了


原文地址:https://www.cnblogs.com/bigbigxiao/p/12101904.html