Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin

1、 报错信息

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

  • Please refer to 项目路径\target\surefire-reports for the individual test results.

  • 说明

    • 使用maven-surefire-plugin:2.21.0插件执行XXX项目中的test存在异常;

    • 异常信息位置:项目路径\target\surefire-reports目录下回记录test存在的异常信息
      在这里插入图片描述

2、 maven-surefire-plugin插件简介

  • test在构建生命周期的阶段中,将使用Surefire插件来执行应用程序的单元测试。它以两种不同的文件格式生成报告:

    • 纯文本文件(*.txt
    • XML档案(*.xml
  • 默认情况下,这些文件是在中生成的${basedir}/target/surefire-reports/TEST-*.xml

3、解决办法

项目进行package/install的时候跳过test

  • 方式一:使用命令进行实现跳过(这种方式需要每次操作的时候都添加跳过测试的配置)

    mvn clean install -Dmaven.test.skip=true
    
  • 方式二:pom.xml配置文件中添加跳过测试的配置(这种方式一劳永逸,配置之后,package/install都会跳过测试)

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值