Problems in Jenkins Guided tour on Mac - macos

I just downloaded Jenkins using brew and I installed Docker CE.
When I try to execute the pipeline in the Guided Tour:
pipeline {
agent { docker 'maven:3.3.3' }
stages {
stage('build') {
steps {
sh 'mvn --version'
}
}
}
}
the build fails with the following error:
/Users/C0228983/.jenkins/workspace/POC_develop-6BCMWWG26VSSPB6S7LLDJWBDCIGFTA2YRE63L5XCEQAEMWYYDVTQ#tmp/durable-cc73be26/script.sh: line 2: docker: command not found
As you see docker in not available in the $PATH.
How could I modify the $PATH? are there more things to consider in order to install jenkins on a Mac an use Docker agent?
After a manual update of $PATH in the Jenkinsfile another error appear:
java.io.IOException: Cannot run program "docker": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:245)
at hudson.Proc$LocalProc.<init>(Proc.java:214)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:846)
at hudson.Launcher$ProcStarter.start(Launcher.java:384)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.launch(DockerClient.java:268)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.launch(DockerClient.java:249)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.launch(DockerClient.java:246)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.version(DockerClient.java:218)
at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:136)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:184)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:18)
at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(jar:file:/Users/C0228983/.jenkins/plugins/docker-workflow/WEB-INF/lib/docker-workflow.jar!/org/jenkinsci/plugins/docker/workflow/Docker.groovy:128)
at org.jenkinsci.plugins.docker.workflow.Docker.node(jar:file:/Users/C0228983/.jenkins/plugins/docker-workflow/WEB-INF/lib/docker-workflow.jar!/org/jenkinsci/plugins/docker/workflow/Docker.groovy:63)
at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(jar:file:/Users/C0228983/.jenkins/plugins/docker-workflow/WEB-INF/lib/docker-workflow.jar!/org/jenkinsci/plugins/docker/workflow/Docker.groovy:116)
at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.DockerPipelineScript.runImage(jar:file:/Users/C0228983/.jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineScript.groovy:54)
at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.AbstractDockerPipelineScript.configureRegistry(jar:file:/Users/C0228983/.jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/AbstractDockerPipelineScript.groovy:68)
at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.AbstractDockerPipelineScript.run(jar:file:/Users/C0228983/.jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/AbstractDockerPipelineScript.groovy:54)
at org.jenkinsci.plugins.pipeline.modeldefinition.agent.CheckoutScript.checkoutAndRun(jar:file:/Users/C0228983/.jenkins/plugins/pipeline-model-extensions/WEB-INF/lib/pipeline-model-extensions.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/CheckoutScript.groovy:57)
at org.jenkinsci.plugins.pipeline.modeldefinition.agent.CheckoutScript.doCheckout(jar:file:/Users/C0228983/.jenkins/plugins/pipeline-model-extensions/WEB-INF/lib/pipeline-model-extensions.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/CheckoutScript.groovy:40)
at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.LabelScript.run(jar:file:/Users/C0228983/.jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/LabelScript.groovy:44)
at ___cps.transform___(Native Method)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
at sun.reflect.GeneratedMethodAccessor229.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
at com.cloudbees.groovy.cps.Next.step(Next.java:74)
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:165)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:330)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at hudson.Proc$LocalProc.<init>(Proc.java:245)
at hudson.Proc$LocalProc.<init>(Proc.java:214)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:846)
at hudson.Launcher$ProcStarter.start(Launcher.java:384)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.launch(DockerClient.java:268)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.launch(DockerClient.java:249)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.launch(DockerClient.java:246)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.version(DockerClient.java:218)
at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:136)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:184)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:18)
... 29 more
Versions:
osx 10.11.6
docker: 17.03.1-ce, build c6d412e
jenkins-lts: stable 2.46.2 (homebrew)

I just found the solution for the missing paths in $PATH but not for the IOException:
Go to Jenkins -> Manage Jenkins -> Configure System -> Global Properties
Activate Environment variables
Add a new one:
Name: PATH
Value: /usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Docker was installed in: /usr/local/bin/

Related

Installing ant-1.10 x fails on one of my two Windows slaves

I'm working in a development environment that uses Jenkins 1.620 for running build & test jobs.
We're using Ant plugin 1.5 & Mercurial plugin 1.54 for integrating with respectively Ant & Mercurial :
In one of our build jobs, I'm trying to run ant-1.10 x :
This works as expected on our Linux slaves :
[28ed6df2] $ /usr/bin/hg log --template "<changeset node='{node}' author='{author|xmlescape}' rev='{rev}' date='{date}'><msg>{desc|xmlescape}</msg><added>{file_adds|stringify|xmlescape}</added><deleted>{file_dels|stringify|xmlescape}</deleted><files>{files|stringify|xmlescape}</files><parents>{parents}</parents></changeset>\n" --rev "ancestors('349ba3fc4e01c8a12fcfbe8d69c3e23913c5122f') and not ancestors(cadec7ae4013241d45a0ca048c801ad55d751604)" --encoding UTF-8 --encodingmode replace
[ant-1.10.x] $ sh -e /home/release/jenkins-slave/tools/hudson.tasks.Ant_AntInstallation/ant-1.10.x/hudson1700384793561784219.sh
pulling from https://elmo.luciad.com/hg/tools/devscripts/
searching for changes
no changes found
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[28ed6df2] $ /home/release/jenkins-slave/tools/hudson.tasks.Ant_AntInstallation/ant-1.10.x/devscripts/ant/apache-ant-1.10.x/bin/ant -Djdk=8u121 -Dlabel_exp=linux&&chrome&&firefox&&nodejs -Dria.testconfig=common/test/responsibilities/milsym clean test
Buildfile: /home/release/jenkins-slave/workspace/LuciadRIA - 2017.1 - TEST - MilSym/28ed6df2/build.xml
It works as expected on one of our Windows slaves :
[ab4857c1] $ "C:\Program Files\TortoiseHg/hg" log --template "<changeset node='{node}' author='{author|xmlescape}' rev='{rev}' date='{date}'><msg>{desc|xmlescape}</msg><added>{file_adds|stringify|xmlescape}</added><deleted>{file_dels|stringify|xmlescape}</deleted><files>{files|stringify|xmlescape}</files><parents>{parents}</parents></changeset>\n" --rev "ancestors('cadec7ae4013241d45a0ca048c801ad55d751604') and not ancestors(20171294f31b5a54c90d7a7ca843d54af5235fdb)" --encoding UTF-8 --encodingmode replace
[ant-1.10.x] $ cmd /c call C:\Users\release\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x\hudson3353656856975714646.bat
C:\Users\release\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x>IF EXIST devscripts (hg -R devscripts pull ) ELSE (hg clone -U "https://elmo.luciad.com/hg/tools/devscripts/" )
pulling from https://elmo.luciad.com/hg/tools/devscripts/
searching for changes
no changes found
C:\Users\release\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x>hg -R devscripts up -C default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[ab4857c1] $ cmd.exe /C '"C:\Users\release\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x\devscripts\ant\apache-ant-1.10.x\bin\ant.bat -Djdk=8u121 "-Dlabel_exp=windows10&&chrome&&firefox&&edge&&ie11&&nodejs" -Dria.testconfig=common/test/responsibilities/milsym clean test && exit %%ERRORLEVEL%%"'
Buildfile: C:\Users\release\jenkins-slave\workspace\LuciadRIA - 2017.1 - TEST - MilSym\ab4857c1\build.xml
However, on another one of our Windows slaves, it fails :
[ab4857c1] $ "C:\Program Files\TortoiseHg/hg" log --template "<changeset node='{node}' author='{author|xmlescape}' rev='{rev}' date='{date}'><msg>{desc|xmlescape}</msg><added>{file_adds|stringify|xmlescape}</added><deleted>{file_dels|stringify|xmlescape}</deleted><files>{files|stringify|xmlescape}</files><parents>{parents}</parents></changeset>\n" --rev "ancestors('cadec7ae4013241d45a0ca048c801ad55d751604') and not ancestors(20171294f31b5a54c90d7a7ca843d54af5235fdb)" --encoding UTF-8 --encodingmode replace
[ant-1.10.x] $ sh -e C:\Users\jslegers\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x\hudson6544351975704303707.sh
The system cannot find the file specified
FATAL: Cannot run program "sh" (in directory "C:\Users\jslegers\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x"): CreateProcess error=2, The system cannot find the file specified
java.io.IOException: Cannot run program "sh" (in directory "C:\Users\jslegers\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
at hudson.Launcher$ProcStarter.start(Launcher.java:382)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:325)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1$1.run(Engine.java:69)
at java.lang.Thread.run(Unknown Source)
at ......remote call to dover(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1361)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
at hudson.remoting.Channel.call(Channel.java:753)
at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929)
at hudson.Launcher$ProcStarter.start(Launcher.java:382)
at hudson.Launcher$ProcStarter.join(Launcher.java:389)
at hudson.tools.AbstractCommandInstaller.performInstallation(AbstractCommandInstaller.java:77)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
at hudson.tasks.Ant$AntInstallation.forNode(Ant.java:430)
at hudson.tasks.Ant.perform(Ant.java:169)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
at hudson.model.Run.execute(Run.java:1741)
at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
at hudson.Launcher$ProcStarter.start(Launcher.java:382)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:325)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1$1.run(Engine.java:69)
at java.lang.Thread.run(Unknown Source)
It appears that Jenkins doesn't know this latter slave is a Windows machine, causing it run sh -e instead of cmd /c.
Do you have any idea why Jenkins fails to recognize this as a Windows machine? And can you think of any way to fix this problem other than installing something like Cygwin?
My second slave had the tags win64 and windows10, but not windows.
The lack of this label caused the slave to not be recognized as a Windows machine.
Adding the tag fixed the problem.

jenkins pipeline bash execution

I'm trying to make a simple jenkins pipeline and run it on windows 10:
pipeline {
agent any
stages {
stage('Stage 1') {
steps {
sh 'echo "egfr"'
}
}
}
}
And I get the error:
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:249)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
at hudson.Launcher$ProcStarter.start(Launcher.java:449)
at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:186)
at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:71)
at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:176)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:229)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:157)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:133)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:129)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
Caused: java.io.IOException: Cannot run program "nohup" (in directory "C:\Program Files (x86)\Jenkins\workspace\p"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:249)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
at hudson.Launcher$ProcStarter.start(Launcher.java:449)
at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:186)
...
I've already tried to set Shell executable as C:\Windows\system32\cmd.exe and C:\cygwin64\bin\sh.exe but I've got the same error. How can I solve the problem?
It is a bit late, but for future I'll add the answer as I had similar issue.
On windows you cannot execute "sh" pipeline step. Neither you, nor jenkins plugins (some do try. exp: docker pipeline). You can use bat, powershell or try this to enable sh on windows (worked for me):
1) install GIT Bash
2) add C:\Program Files\Git\usr\bin to PATH
3) restart Jenkins

Jenkins Project Maven

I'm having a problem with compiling a simple maven project in Jenkins, I don't understand what happened.
This project compiles perfectly out for Jenkins server.
I am using JDK 8, Maven 3.3.9, operation system Ubuntu Server.
Error Log:
Established TCP socket on 37158<===[JENKINS REMOTING CAPACITY]===>channel started Executing Maven: -N -B -f /var/lib/jenkins/workspace/AArcoOneProject/AArco-One-Pojo/pom.xml compile
java.lang.NullPointerException
at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:133)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:68)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Lanzada por el usuario Diego Fernando Hidalgo Cornejo
Finished: ABORTED
FATAL: java.lang.reflect.InvocationTargetException
java.io.IOException: java.lang.reflect.InvocationTargetException
at hudson.maven.Maven3Builder.call(Maven3Builder.java:173)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:68)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to Channel to Maven [/usr/lib/jvm/java-8-oracle/bin/java, -cp, /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven33-agent-1.8.1.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging, jenkins.maven3.agent.Maven33Main, /opt/apache-maven-3.3.3, /var/cache/jenkins/war/WEB-INF/lib/remoting-2.62.3.jar, /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven33-interceptor-1.8.1.jar, /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.8.1.jar, 37158](Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1433)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
at hudson.remoting.Channel.call(Channel.java:797)
at hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:161)
at hudson.maven.MavenBuild$MavenBuildExecution.doRun(MavenBuild.java:880)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1720)
at hudson.maven.MavenBuild.run(MavenBuild.java:270)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:133)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:68)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.Exception: java.lang.NullPointerException
at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:189)
... 14 more
Caused by: java.lang.NullPointerException
at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
... 14 more
Finished: FAILURE
Check which settings.xml file is in used, run mvn with -X , you will see in the start of the output which file is used.
I had the same issue, when mvn used the default file and we used another file on our local env.
BTW, did you install MVN on the slave or Jenkins did it for you?

Commands not running in gradle gui

when ever i am trying to use gradle gui with the following command:
./gradlew --gui
It shows an errorlike this
Gradle is not installed, as i am using gradle wrapper
Gradle version in wrapper is 2.10
oracle java 8
I had seen the error on console...
Starting external process
org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/home/manisha/.gradle/wrapper/dists/gradle-2.10-bin/baigpnfu14tdk6ztbfwcl8275/gradle-2.10/bin/gradle''
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:197)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:327)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/home/manisha/.gradle/wrapper/dists/gradle-2.10-bin/baigpnfu14tdk6ztbfwcl8275/gradle-2.10/bin/gradle'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
... 5 more
Caused by: java.io.IOException: Cannot run program "/home/manisha/.gradle/wrapper/dists/gradle-2.10-bin/baigpnfu14tdk6ztbfwcl8275/gradle-2.10/bin/gradle" (in directory "/media/manisha/manu/twc/OMEGA"): error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 7 more
Caused by: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 8 more
And i get to know that the issue is in giving permission....
thus, i give execution permission to the file gradle under the path /home/manisha/.gradle/wrapper/dists/gradle-2.10-bin/baigpnfu14tdk6ztbfwcl8275/gradle-2.10/bin/gradle using sudo chmod 705 gradle and again run ./gradle --gui
And it run SUCCESSFULLY....:)

Jenkins-Maven Project - Could not initialize class org.apache.tools.ant.Location

I am getting an error as it is not able to initialize the ANT location although it's a Maven project.
For Jenkins job.
The output can be found below:
[htmlpublisher] Archiving HTML reports... [htmlpublisher] Archiving at
PROJECT level
C:\Jenkins\workspace\Capybaras-STAGE-Regression-OnDemand\target\dashboard-reports
to
/home/scmbuildmaster/.jenkins/jobs/Capybaras-STAGE-Regression-OnDemand/htmlreports/Dashboard_Full_Report_with_Screenshot FATAL: HTML Publisher failure java.io.IOException:
java.util.concurrent.ExecutionException:
java.lang.NoClassDefFoundError: Could not initialize class
org.apache.tools.ant.Location at
hudson.FilePath.copyRecursiveTo(FilePath.java:2213) at
hudson.FilePath.copyRecursiveTo(FilePath.java:2101) at
hudson.FilePath.copyRecursiveTo(FilePath.java:2084) at
htmlpublisher.HtmlPublisher.perform(HtmlPublisher.java:213) at
hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at
hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183) at
hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1784) at
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at
hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240) Caused by:
java.util.concurrent.ExecutionException:
java.lang.NoClassDefFoundError: Could not initialize class
org.apache.tools.ant.Location at
hudson.remoting.Channel$3.adapt(Channel.java:784) at
hudson.remoting.Channel$3.adapt(Channel.java:779) at
hudson.remoting.FutureAdapter.get(FutureAdapter.java:55) at
hudson.FilePath.copyRecursiveTo(FilePath.java:2211) ... 12 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class
org.apache.tools.ant.Location at
org.apache.tools.ant.ProjectComponent.(ProjectComponent.java:43)
at org.apache.tools.ant.types.DataType.(DataType.java:40) at
org.apache.tools.ant.types.AbstractFileSet.(AbstractFileSet.java:82)
at org.apache.tools.ant.types.FileSet.(FileSet.java:36) at
hudson.Util.createFileSet(Util.java:1077) at
hudson.util.DirScanner$Glob.scan(DirScanner.java:124) at
hudson.FilePath.writeToTar(FilePath.java:2249) at
hudson.FilePath.access$2100(FilePath.java:191) at
hudson.FilePath$45.invoke(FilePath.java:2190) at
hudson.FilePath$45.invoke(FilePath.java:2186) at
hudson.FilePath$FileCallableWrapper.call(FilePath.java:2665) at
hudson.remoting.UserRequest.perform(UserRequest.java:121) at
hudson.remoting.UserRequest.perform(UserRequest.java:49) at
hudson.remoting.Request$2.run(Request.java:324) at
hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
hudson.remoting.Engine$1$1.run(Engine.java:63) at
java.lang.Thread.run(Unknown Source) at ......remote call to
QA-Automation-Node(Native Method) at
hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1356)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:221) at
hudson.remoting.Channel$3.adapt(Channel.java:782) ... 15 more Build
step 'Publish HTML reports' changed build result to FAILURE
Try the following, in the following order:
Try to upgrade the JRE version that you use to run the slave process
If you are using a JRE to run your slave, use a JDK If you are using
an OpenJDK, try with an Oracle JDK

Resources