我正在尝试从jenkins那里运行测试构建。
在所有16次测试成功之后,我得到了构建成功的信息,我得到了这一行
[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
Jenkins配置
那是为什么?
发布于 2022-03-20 11:50:12
这是执行的命令:
[BE UAT] $ cmd.exe /C '""C:\Program Files\Selenium\apache-maven-3.8.1\bin\mvn.cmd"' mvn compile && exit %%ERRORLEVEL%%"
如您所见,cmd.exe
正在运行以mvn compile
作为参数的mvn.cmd
。换句话说,您正在运行mvn mvn compile
。
编辑:如果您使用了“调用顶级Maven目标”的“经典”自由式作业,那么Maven目标应该是而不是包含mvn
。Maven命令是根据目标(clean
、package
等)构建的。和选项(-DsomeOption=someValue
)。在自由式作业中,可以添加选项作为目标的一部分(在这种情况下,它们应该包括-D
前缀),也可以单独添加选项作为“高级”下选项的一部分(在这种情况下,您应该省略-D
前缀)。
https://stackoverflow.com/questions/71546449
复制相似问题