1. 程式人生 > >maven打包工程出現錯誤 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test

maven打包工程出現錯誤 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test

cut apach 解決辦法 blog 研究 gpo failed fire 描述

今天用maven在命令行打包項目的時候出現錯誤:

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

但是項目用maven編譯沒問題,之前測試也都過了。從上面描述可以確定是單元測試部分有問題,然後仔細研究了錯誤內容,發現是因為我定義了一個測試基類,裏面沒有任何測試方法,拋出了java.lang.Exception: No runnable methods。

解決辦法:增加一個@Ignore,表示打包的時候忽略這個測試類,就能成功了。

maven打包工程出現錯誤 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test