1、slave的build配置如下
2、但是从控制台输出日志来看,pre steps和post steps都执行了,但是build没有执行
3、最后的错误信息如下:
ERROR: Failed to parse POMs java.io.IOException: Cannot run program "java" (in directory "/var/lib/jenkins/workspace/28bafb523cf4f068e51266ade9b154b9"): 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:850) at hudson.Launcher$ProcStarter.start(Launcher.java:384) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1195) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1160) at hudson.remoting.UserRequest.perform(UserRequest.java:153) at hudson.remoting.UserRequest.perform(UserRequest.java:50) at hudson.remoting.Request$2.run(Request.java:336) 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 10-57-19-56(Native Method) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545) at hudson.remoting.UserResponse.retrieve(UserRequest.java:253) at hudson.remoting.Channel.call(Channel.java:830) at hudson.Launcher$RemoteLauncher.launch(Launcher.java:959) at hudson.Launcher$ProcStarter.start(Launcher.java:384) at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:278) at hudson.maven.ProcessCache.get(ProcessCache.java:236) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:798) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490) at hudson.model.Run.execute(Run.java:1735) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:415) 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:248) 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:850) at hudson.Launcher$ProcStarter.start(Launcher.java:384) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1195) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1160) at hudson.remoting.UserRequest.perform(UserRequest.java:153) at hudson.remoting.UserRequest.perform(UserRequest.java:50) at hudson.remoting.Request$2.run(Request.java:336) 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) [WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done Finished: FAILURE
4、slave节点的系统信息里的环境变量如下
5、解决办法:
在/usr/bin下添加java的软链接,使其指向真正的java执行文件位置
master机器也是这样配置的,有个java的软链接指向java
参考:https://issues.jenkins-ci.org/browse/JENKINS-24788