Trying for CI/CD in mule 4 using Jenkins and I have installed Java (Jdk 1.8) and Maven Properly ,then set environment variable similarly.
When I'm run Build now in Jenkins it returns Build Failure .
Console Log in Jenkins :
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
CodePudding user response:
That's a Jenkins configuration issue. It is probably running as a service (Running as SYSTEM
) so your environment variables are not accessible. You need to configure the JDK or JAVA_HOME inside Jenkins configuration. Try one of the methods in this answer: https://stackoverflow.com/a/57798017/721855