无法使用命令行构建Maven项目

时间:2020-08-07 08:10:09

标签: maven

我正在尝试使用命令行构建Maven项目

c:\data\maven-demo\maven-test-project\Java>mvn test

here

我在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

1 个答案:

答案 0 :(得分:0)

问题是单元测试失败。单元测试AppTest.testShouldBeFailed失败,因此构建无法通过。

快速修复,您可以简单地将assertTrue(false);更改为assertTrue(true);