解决错误 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. 用深度学习模型Word2Vec探索《红楼梦》人物关系

    先来看一看结果,发现: 1.贾宝玉和袭人的关系最近. 2.薛宝钗和自己的妈妈关系最近. 3.贾宝玉和林黛玉逼格比较统一,薛宝钗属于独树一帜的逼格调性. 4.大观园中可以看到邢岫烟经常出没... 还有更 ...

  2. canvas合并图片并长按保存

    代码实现 <div class="pho-bg"> <img src="../../assets/images/FeedbackActivity/pos ...

  3. 计算机网络基础(3):IP与子网掩码/ ping/ ipconfig/ VLAN/ 网络服务器配置

    chapter4 构建中型网络 1. IP地址与子网掩码 A类地址:网络ID开头是0,范围从00000001到01111110,126个,其中0 127留作他用.在每个网段里(网络ID),可以容纳2* ...

  4. ssr next 学习记录

    预加载页面   只有生产环境才有 当页面初始化加载时,getInitialProps只会加载在服务端.只有当路由跳转(Link组件跳转或 API 方法跳转)时,客户端才会执行getInitialPro ...

  5. mac 查看,终止进程

    找到其他 活动监视器 在这里可以查看和cpu占用 杀死有问题的过程: 1.它占用了大量CPU周期或内存, 2.在"活动监视器"中被突出显示为已崩溃, 先单击该过程,点击x可以终止进 ...

  6. memoのcmake和pkgconfig

    之前看到过pkgconfig,完全不理解什么东西,也没有去探究这到底是个啥. 然而今天想要cmake brew的库,无意中查到一种解决方案,就是利用pkg-config. 老神奇了. # includ ...

  7. 专业家庭影音服务器-硬件平台x86+固态盘+sata机械盘

    提到影音绕不开的就是大容量存储,就目前情况机械硬盘的海量存储还是唯一选择,所以实现起来总是绕不开NAS这个思路,比较起来,常规PC系统,固态和机械相结合,或许才是终极解决方案. 老式硬件 过失的产品在 ...

  8. Ant Design 分页数据回显问题

    我们可以创建一个新的值来保存这些数据allSingleSelectedRowKeys: 下面是我们的HTML结构 <a-table :row-selection="{ selected ...

  9. iOS用runtime给一个类动态添加方法 ---class_addMethod

    先介绍下class_addMethod这个fangfa   /**   * Adds a new method to a class with a given name and implementat ...

  10. python修改图片名

    1 import glob 2 import os 3 4 inputPath = r'E:/data/pic/cat' 5 fileList = glob.glob(inputPath + '/*' ...