【发布时间】:2022-01-28 20:37:10
【问题描述】:
我尝试使用参数-Dmessage="update parent pom" 为scm:checkin 目标执行Maven。这可以在我的本地计算机上顺利运行,但是当我尝试在 Azure DevOps YAML 管道中使用 Maven task 运行它时,它会失败。
- task: Maven@3
inputs:
mavenPomFile: pom.xml
goals: clean verify scm:checkin -Dmessage="update parent pom"
在管道的输出中,它正确地表示将执行以下命令:
/usr/share/maven/bin/mvn -f /__w/45/s/pom.xml clean verify scm:checkin -Dmessage="update parent pom"
但是,该命令的执行就像没有空格一样,并且单词 parent 被假定为另一个 maven 目标,而不是消息的一部分。以下日志摘录显示scm:checkin 目标已成功执行,并且应该执行另一个名为parent 的目标:
...
[INFO]
[INFO] ---------------------------< example:project >--------------------------
[INFO] Building example project 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-scm-plugin:2.0.0-M1:checkin (default-cli) @ project ---
[INFO] Executing: /bin/sh -c cd '/__w/45/s' && 'git' 'rev-parse' '--show-prefix'
[INFO] Working directory: /__w/45/s
[INFO] Executing: /bin/sh -c cd '/__w/45/s' && 'git' 'status' '--porcelain' '.'
[INFO] Working directory: /__w/45/s
[INFO]
[INFO] ---------------------------< example:project >--------------------------
[INFO] Building example project 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.784 s
[INFO] Finished at: 2022-01-28T20:14:44Z
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "parent". 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
The process '/usr/share/maven/bin/mvn' failed with exit code 1
我尝试了各种引号、双引号、反斜杠转义、仅用于字符串和整个 YAML 值的组合,但结果始终相同。
【问题讨论】:
标签: maven azure-devops azure-pipelines