Tony Stark Tony Stark - 2 months ago 10
Git Question

having trouble during initial build for project "gameoflife" when following "jenkins the definitive guide" by john ferguson

I'm a beginner trying to learn Jenkins by following "Jenkins the definitive guide" by John Ferguson. I have downloaded the sample project "gameoflife" from github and have set the initial configuration for maven, git and java jdk. However, when I first start the build process, the project is suppose to pass. But I keep getting build failure message. Because I'm new to Jenkins, I am not sure what I did wrong and how to fix it. Could someone please give me a hand? I have attached a copy of the failure message below. Thanks in advance for any help!

Started by an SCM change
Building in workspace C:\Users\Justin\.jenkins\workspace\gameoflife-default
Installing C:\Users\Justin\.jenkins\tools\hudson.model.JDK\jdk.exe
[hudson.model.JDK] $ C:\Users\Justin\.jenkins\tools\hudson.model.JDK\jdk.exe /s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\Users\Justin\.jenkins\tools\hudson.model.JDK /L C:\Users\Justin\.jenkins\tools\install5268142390914952134log
java.io.IOException: Cannot run program "C:\Users\Justin\.jenkins\tools\hudson.model.JDK\jdk.exe" (in directory "C:\Users\Justin\.jenkins\tools\hudson.model.JDK"): CreateProcess error=740, The requested operation requires elevation
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:240)
at hudson.Proc$LocalProc.<init>(Proc.java:212)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.Launcher$ProcStarter.join(Launcher.java:388)
at hudson.tools.JDKInstaller.install(JDKInstaller.java:271)
at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:144)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
at hudson.model.JDK.forNode(JDK.java:144)
at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:357)
at hudson.model.Run.getEnvironment(Run.java:2232)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:922)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1090)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: java.io.IOException: CreateProcess error=740, The requested operation requires elevation
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 25 more
Archiving artifacts
ERROR: Failed to archive artifacts: **/target/*.jar
java.io.IOException: Unable to delete 'C:\Users\Justin\.jenkins\tools\hudson.model.JDK'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
at hudson.Util.deleteFile(Util.java:257)
at hudson.FilePath.deleteRecursive(FilePath.java:1231)
at hudson.FilePath.access$1000(FilePath.java:195)
at hudson.FilePath$14.invoke(FilePath.java:1201)
at hudson.FilePath$14.invoke(FilePath.java:1198)
at hudson.FilePath.act(FilePath.java:1018)
at hudson.FilePath.act(FilePath.java:996)
at hudson.FilePath.deleteRecursive(FilePath.java:1198)
at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:133)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
at hudson.model.JDK.forNode(JDK.java:144)
at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:357)
at hudson.model.Run.getEnvironment(Run.java:2232)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:922)
at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:234)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: java.nio.file.DirectoryNotEmptyException: C:\Users\Justin\.jenkins\tools\hudson.model.JDK
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source)
at java.nio.file.Files.deleteIfExists(Unknown Source)
at hudson.Util.tryOnceDeleteFile(Util.java:296)
at hudson.Util.deleteFile(Util.java:252)
... 26 more
Recording test results
ERROR: Step ‘Publish JUnit test result report’ aborted due to exception:
java.io.IOException: Unable to delete 'C:\Users\Justin\.jenkins\tools\hudson.model.JDK'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
at hudson.Util.deleteFile(Util.java:257)
at hudson.FilePath.deleteRecursive(FilePath.java:1231)
at hudson.FilePath.access$1000(FilePath.java:195)
at hudson.FilePath$14.invoke(FilePath.java:1201)
at hudson.FilePath$14.invoke(FilePath.java:1198)
at hudson.FilePath.act(FilePath.java:1018)
at hudson.FilePath.act(FilePath.java:996)
at hudson.FilePath.deleteRecursive(FilePath.java:1198)
at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:133)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
at hudson.model.JDK.forNode(JDK.java:144)
at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:357)
at hudson.model.Run.getEnvironment(Run.java:2232)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:922)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:146)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: java.nio.file.DirectoryNotEmptyException: C:\Users\Justin\.jenkins\tools\hudson.model.JDK
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source)
at java.nio.file.Files.deleteIfExists(Unknown Source)
at hudson.Util.tryOnceDeleteFile(Util.java:296)
at hudson.Util.deleteFile(Util.java:252)
... 26 more
Finished: FAILURE

Answer

The relevant error message is

Cannot run program "C:\Users\Justin\.jenkins\tools\hudson.model.JDK\jdk.exe" 
(in directory "C:\Users\Justin\.jenkins\tools\hudson.model.JDK"): 
CreateProcess error=740, The requested operation requires elevation
    at java.lang.ProcessBuilder.start(Unknown Source)

Caused by: java.io.IOException: CreateProcess error=740, 
The requested operation requires elevation
    at java.lang.ProcessImpl.create(Native Method)

The call stack involves

hudson.tools.JDKInstaller.install

Try and check the configuration of your Jenkins, and check if there is an "Install automatically" selected in either your job or in Jenkins "Configure System" main settings section.

https://www.safaribooksonline.com/library/view/jenkins-the-definitive/9781449311155/httpatomoreillycomsourceoreillyimages864759.png

Make sure you unselect that option, and reference the path of a jdk already installed (before following Ferguson's example).