【问题标题】:Facing issue while executing Maven project in Jenkins在 Jenkins 中执行 Maven 项目时面临问题
【发布时间】:2019-11-05 15:04:38
【问题描述】:

start of log Complete error message

在 Jenkins 中执行 Maven 项目时遇到问题。 无法从 gitthub 执行项目。

错误信息在下面重现。

O Console Output
Started by user Selvakumar V
Running as SYSTEM
Building in workspace C: \Program Files\Jenkins\workspace\FreeCRMTestProject
Parsing POAs
Established TCP socket on 49852
[MavenProjectGitl] $ java -cp "C:\Program Files\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-agent-3.3.9/conf/logging" \
jenkins.maven3.agent.Maven33Main E:\Java\SeleniumDava\Jars\apache-maven-3.3.9 \
"C:\Program Files\Jenkins\war\WEB-INF\lib\remoting-3.29.jar" \
"C:\Program Files\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-interceptor-l.13.jar" \
"C:\Program Files\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-l.13.jar" 49852
<===JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f D:\MavenProjectGitl\pon.xml Clean Install
[INFO] Scanning for projects...
[INFO]
[INFO] 
[INFO] Building MavenProjectúitl 0.0.1-SNAPSHOT
[INFO] 
[INFO] 
[INFO] BUILD FAILURE
[INFO] 
[INFO] Total time: 1.749 s
[INFO] Finished at: 2019-l1-05T19:59:08+05:30
[INFO] Final Memory: 6M/17M
[INFO] 
[ERROR] Unknown lifecycle phase "Clean". 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
[JENKINS] Archiving D:\MavenProjectGitl\pom.xml to MavenProjectGit/MavenProjectGitl/0.0.1-SNAPSHOT/frlavenProjectGitl-0.0.1-SNAPSHOT.pom
channel stopped
Finished: FAILURE

【问题讨论】:

  • "干净" != "干净"
  • 错误信息试图告诉你一些事情。不过与其试图理解,不如截个图上传到这里?
  • @azurefrog 你能解释一下吗
  • "Clean" 和 "clean" 不是同一个字符串。一个是 Maven 中的有效生命周期阶段,另一个不是。我不确定如何更清楚。
  • 谢谢@azurefrog。我解决了这个问题,我的 Maven 项目在 jenkins 中成功执行。

标签: maven jenkins


【解决方案1】:

正如@azurefrog 通过评论所解释的那样,"Clean" != "clean"、Jenkins、Maven 和 Linux 都区分大小写,这就是为什么“干净”不匹配“可用生命周期”之一阶段”,因此错误消息:

Unknown lifecycle phase "Clean".

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, preintegration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.

maven 生命周期文档没有明确指出它,但 pom 设置确实暗示了 Properties

注意:虽然环境变量本身不区分大小写 Windows,属性查找区分大小写。换句话说,虽然 Windows shell 为 %PATH% 和 %Path% 返回相同的值,Maven 区分 ${env.PATH} 和 ${env.Path}。的名字 为了方便起见,环境变量被标准化为全部大写 可靠性。

另外,请阅读我对您的问题的评论。如果您觉得此答案有用,请标记为“已回答”(勾选框)。

【讨论】:

    猜你喜欢
    • 2017-06-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-16
    • 2021-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-04
    相关资源
    最近更新 更多