从詹金斯成功构建后的错误行

Errors lines after success build from jenkins

我正在尝试 运行 从 jenkins 构建测试

在所有 16 次测试都成功之后,我收到消息 BUILD SUCCESS 我收到了这条线

[INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:15 min
[INFO] Finished at: 2022-03-20T12:36:01+02:00
[INFO] ------------------------------------------------------------------------
[BE UAT] $ cmd.exe /C '""C:\Program Files\Selenium\apache-maven-3.8.1\bin\mvn.cmd"' mvn compile && exit %%ERRORLEVEL%%"
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------------------< Maven:miron >-----------------------------
[INFO] Building miron 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.073 s
[INFO] Finished at: 2022-03-20T12:36:02+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/LifecyclePhaseNotFoundException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

詹金斯配置

Picture

为什么会这样?

这是执行的命令:

[BE UAT] $ cmd.exe /C '""C:\Program Files\Selenium\apache-maven-3.8.1\bin\mvn.cmd"' mvn compile && exit %%ERRORLEVEL%%"

如您所见,cmd.exe 是 运行 mvn.cmd,参数是 mvn compile。换句话说,你是 运行 mvn mvn compile.

编辑:如果您使用带有“调用 top-level Maven 目标”步骤的“经典”自由式作业,Maven 目标应该包含mvn. Maven 命令是根据目标(cleanpackage 等)和选项(-DsomeOption=someValue)构建的。在自由式作业中,您可以将选项添加为目标的一部分(在这种情况下它们应该包含 -D 前缀),或者单独作为“高级”下选项的一部分(在这种情况下您应该省略 -D 前缀).