簡體   English   中英

在 Jenkins 中執行 Maven 項目時面臨問題

[英]Facing issue while executing Maven project in Jenkins

日志開始完整的錯誤信息

在 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

很高興您在評論中得到答案,但是...

請不要張貼文字圖片 - 它對任何人都沒有幫助,也不會(通常)為您提供幫助。 將文本粘貼為文本並將其標記為“ {} ”文本塊。 其他人無法搜索圖像。 @f1sh 諷刺也可能無法翻譯。

是的,Jenkins 區分大小寫,Maven 和 Linux 也是如此。 正如@azurefrog 相當陳詞濫調的解釋, "Clean" != "clean"

最后,請閱讀我如何提出一個好問題

ps:現在看起來不是一個更好的問題嗎? 請將此回復標記為“已回答”(勾選標記)。

As @azurefrog explained rather tritely explained via the comment, "Clean" != "clean" , Jenkins, Maven and Linux are all case-sensitive , that's why "Clean" does not match one of the "Available lifecycle phases", hence the錯誤信息:

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 設置確實暗示在屬性

注意:雖然環境變量本身在 Windows 上不區分大小寫,但屬性查找區分大小寫。 換句話說,雖然 Windows shell 為 %PATH% 和 %Path% 返回相同的值,但 Maven 區分 ${env.PATH} 和 ${env.PATH}。 為了可靠起見,環境變量的名稱被規范化為全部大寫。

另外,請閱讀我對您的問題的評論。 如果您發現此答案有用,請標記為“已回答”(勾選框)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM