maven - 无法使用命令行构建 maven 项目
问题描述
我正在尝试使用命令行构建 maven 项目
c:\data\maven-demo\maven-test-project\Java>mvn test
我在 c:\data\maven-demo\maven-test-project\Java 中有什么
我有这样的错误:
在此处输入代码
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to c:\data\maven-demo\maven-test-project\Java\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M1:test (default-test) @ hello-ci ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.github.vitalliuss.helloci.AppTest
[ERROR] Tests run: 5, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 0.031 s <<< FAILURE! - in com.github.vitalliuss.helloci.AppTest
[ERROR] testShouldBeFailed(com.github.vitalliuss.helloci.AppTest) Time elapsed: 0.006 s <<< FAILURE!
java.lang.AssertionError
at com.github.vitalliuss.helloci.AppTest.testShouldBeFailed(AppTest.java:21)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] AppTest.testShouldBeFailed:21
[INFO]
[ERROR] Tests run: 5, Failures: 1, Errors: 0, Skipped: 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.382 s
[INFO] Finished at: 2020-08-06T16:40:02+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test) on project hello-ci: There are test failures.
[ERROR]
[ERROR] Please refer to c:\data\maven-demo\maven-test-project\Java\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
我使用 maven C:\apache-maven-3.6.3 使用 C:\Program Files\Java\jdk-13.0.1
解决方案
问题是单元测试失败。单元测试AppTest.testShouldBeFailed
失败,因此构建不会通过。
快速修复,您可以简单地assertTrue(false);
更改assertTrue(true);
推荐阅读
- javascript - 如何用两个单独的javascript代码制作两个画布?
- android - sendPasswordResetEmail 现在返回“您的密码已过期或链接已被使用”
- c# - Durable Azure Function Orchestrator 是否会释放计时器锁定?
- ios - 是否可以在不使用 Swift UI 的情况下在 Xcode 11.2 或更高版本中使用 Swift 创建 App Clip?
- asp.net - HTTP 错误 403.14 - Web 服务器配置为不列出此目录的内容。在 .NET 核心 3.1 中
- python - 将带有嵌套列表的字典转换为特定的 pandas df 结构
- java - JPA无法从子类列表中访问父类
- bash - 在 bash 脚本之间共享一个变量
- r - 使用 tidymodels 的 GLM 系列
- javascript - 即使定义了字段,为什么我的谷歌位置附近搜索返回气氛和联系数据?