使用 Jenkins 在 mule 4 中嘗試 CI/CD,我已經正確安裝了 Java(Jdk 1.8)和 Maven,然后類似地設定環境變數。
當我現在在 Jenkins 中運行 Build 時,它回傳 Build Failure 。
控制臺登錄詹金斯:
Started by user manikandan
Running as SYSTEM
Building in workspace C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\jenkins-demo
The recommended git tool is: NONE
using credential ae3accaa-834e-46ea-848b-ca852dc658ea
> C:\Program Files\Git\bin\git.exe rev-parse --resolve-git-dir C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\jenkins-demo\.git # timeout=10
Fetching changes from the remote Git repository
> C:\Program Files\Git\bin\git.exe config remote.origin.url https://github.com/Manikandan99/demo.git # timeout=10
Fetching upstream changes from https://github.com/Manikandan99/demo.git
> C:\Program Files\Git\bin\git.exe --version # timeout=10
> git --version # 'git version 2.32.0.windows.2'
using GIT_ASKPASS to set credentials github
> C:\Program Files\Git\bin\git.exe fetch --tags --force --progress -- https://github.com/Manikandan99/demo.git refs/heads/*:refs/remotes/origin/* # timeout=10
> C:\Program Files\Git\bin\git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
Checking out Revision b5d43f7135e1354194086c479823ff0875db5f35 (refs/remotes/origin/master)
> C:\Program Files\Git\bin\git.exe config core.sparsecheckout # timeout=10
> C:\Program Files\Git\bin\git.exe checkout -f b5d43f7135e1354194086c479823ff0875db5f35 # timeout=10
Commit message: "no message"
> C:\Program Files\Git\bin\git.exe rev-list --no-walk b5d43f7135e1354194086c479823ff0875db5f35 # timeout=10
[jenkins-demo] $ cmd /c call C:\Windows\TEMP\jenkins2293083649549764012.bat
C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\jenkins-demo>mvn clean deploy -DmuleDeploy -DskipTests -Dmule.version=4.3.0 -Danypoint.username=javiid26 -Danypoint.password=Javid@26 -Denv=Sandbox -Dappname=jenkins-demo -Dbusiness=AspireSystems -DvCore=Micro -Dworkers=1 -DaltDeploymentRepository=myinternalrepo::default::file:///C:/snapshots
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
專案鏈接:
我的 Pom.xml 檔案:
uj5u.com熱心網友回復:
那是 Jenkins 配置問題。它可能作為服務 ( Running as SYSTEM)運行,因此無法訪問您的環境變數。您需要在 Jenkins 配置中配置 JDK 或 JAVA_HOME。嘗試此答案中的方法之一:https : //stackoverflow.com/a/57798017/721855
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/318830.html
