解决错误 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project qc-offline-report: There are test failures.

1.今天对maven项目进行打包,遇到了一个问题,一直没有解决,后来查阅资料解决了,现在记录下:
执行完clean和package后,控制台输入如下错误

[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.qcsoft.qcofflinereport.QcOfflineReportApplicationTests
[ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.136 s <<< FAILURE! - in com.qcsoft.qcofflinereport.QcOfflineReportApplicationTests
[ERROR] initializationError(com.qcsoft.qcofflinereport.QcOfflineReportApplicationTests) Time elapsed: 0.017 s <<< ERROR!
java.lang.Exception: The class com.qcsoft.qcofflinereport.QcOfflineReportApplicationTests is not public. [ERROR] initializationError(com.qcsoft.qcofflinereport.QcOfflineReportApplicationTests) Time elapsed: 0 s <<< ERROR!
java.lang.Exception: Test class should have exactly one public constructor [ERROR] initializationError(com.qcsoft.qcofflinereport.QcOfflineReportApplicationTests) Time elapsed: 0 s <<< ERROR!
java.lang.Exception: Method contextLoads() should be public [INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] com.qcsoft.qcofflinereport.QcOfflineReportApplicationTests.initializationError(com.qcsoft.qcofflinereport.QcOfflineReportApplicationTests)
[ERROR] Run 1: QcOfflineReportApplicationTests.initializationError » The class com.qcsoft.qc...
[ERROR] Run 2: QcOfflineReportApplicationTests.initializationError » Test class should have ...
[ERROR] Run 3: QcOfflineReportApplicationTests.initializationError » Method contextLoads() s...
[INFO]
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.250 s
[INFO] Finished at: 2020-03-30T16:11:20+08:00
[INFO] Final Memory: 28M/437M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project qc-offline-report: There are test failures.
[ERROR]
[ERROR] Please refer to D:\fzh\qc-offline-report\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

2.解决方案:在原来的maven依赖插件中新加一个maven-surefire-plugin依赖即可

        <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>

加了之后的pom.xml

    <build>
<finalName>qc-offline-report</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on的更多相关文章

  1. maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang

    maven打包成war时,报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default- ...

  2. Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (dist) on project hadoop-kms: An Ant BuildException has occured

    编译cdh版hadoop2.5.0出现的问题 系统: CentOs66 64位 JDK:1.7 Maven: 3.0.5 Protobuf: libprotoc 2.5.0 编译命令: mvn pac ...

  3. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project LogTest: Compilation failure -> [Help 1]

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default ...

  4. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:

    security-sdk-1.0.jar已经存在于D:/secServerSDK-test/src/main/resources/lib下 报错如下: xxxxxx@xxxxxxxx /d/secSe ...

  5. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (default-cli) on project standalone-pom: Unable to parse configuration of 3: mojo org.apache.maven.plugins:

    问题: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (defau ...

  6. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on ...

  7. maven install 报错Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project*****

    [ERROR]Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-co ...

  8. Maven Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean Failed to delete access_log

    I'm trying to run simple struts project using maven and tomcat. When I'm trying to exucute next goal ...

  9. 解决Failed to execute goal org.apache.maven.plugins

    1.Maven构建失败 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 2.3 . 2 :compile  ...

  10. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法

    Maven install失败 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (d ...

随机推荐

  1. angular 用法总结

    架构: 1.一个总页面,然后用组件组成 2.每个组件又由三个文件组成,html,css,ts,三种不同的语言放在三个不同的文件中, 3.ts是总配置文件,里面联合各个其他文件(html,css) 语法 ...

  2. 刚开始学python不知从何学习推荐你一本《Python零基础入门》书,免费领取

    百度云盘:Python零基础入门学习pdf高清版书籍下载 提取码:yzh3        

  3. leetcode 310. 最小高度树 【时间击败70.67%】 【内存击败89.04%】

    数组替代队列,从超时到击败70%,用tree[0]替代new一个新的ArrayList,上升10% 思想是遍历一遍,删除度为1的节点,答案只可能为1或2 1 public List<Intege ...

  4. vue页面多表单验证保存

    页面中有多个表单需要验证,可以使用以下方法: export default { data: { return { addOrEditVo: { name: '', description: '', a ...

  5. 移动端及pc端适配

    1.rem搭配CSS预处理器使用 这里我就用vue+less来简单操作一下,具体可以封装到底层,这里暂且演示一下原理. 这里推荐一下使用我的自制脚手架 (songyao-cli) 来快速生成一个vue ...

  6. node.js请求css、js静态资源页面不生效

    产生原因:文件响应头内容类型错误 解决方案:设置对应的响应头内容类型 const http = require('http'); const fs = require('fs'); const pat ...

  7. PostScript语言教程(六、图形变换)

    6.1.坐标系变换 POSTSCRIPT图形操作是在一个坐标系中,这个坐标系被称为用户坐标系或用户空间,该坐标系独立于任何物理设备.POSTSCRIPT在用户空间中进行绘制,并将结果传输到特定的打印机 ...

  8. [336] Prelude PTS OpCodes

    [336] Prelude PTS Client 00 SendProtocolVersion 01 MoveBackwardToLocation 02 Say 03 RequestEnterWorl ...

  9. linux 基线检查

    1 检查用户缺省UMASK #cat /etc/profile|sed '/^#/d'|sed '/^$/d'|grep -i "umask" 修改umask vi /etc/pr ...

  10. ucharts的区域图、折线图(有x轴的),修改x轴显示为隔一个显示

    1.原本的显示方式: 2.想要的效果: 3.这边我使用的是uchart的组件,在uni_modules > qiun-data-charts > js_sdk > u-charts, ...