项目场景:
Jenkins 2.372 rpm安装方式
jdk 11
问题描述
- 配置jdk中警告
/usr/bin/java is not a directory on the Jenkins controller (but perhaps it exists on some agents)
- 构建过程中出现报错
Parsing POMs
Established TCP socket on 45359
[dev-projectMap] $ /usr/bin/java/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/usr/apache-maven-3.6.3/boot/plexus-classworlds-2.6.0.jar:/usr/apache-maven-3.6.3/conf/logging jenkins.maven3.agent.Maven35Main /usr/apache-maven-3.6.3 /var/lib/jenkins/%C/jenkins/war/WEB-INF/lib/remoting-3063.v26e24490f041.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar 45359
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "/usr/bin/java/bin/java" (in directory "/var/lib/jenkins/workspace/dev-projectMap"): error=20, Not a directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at hudson.Proc$LocalProc.<init>(Proc.java:254)
at hudson.Proc$LocalProc.<init>(Proc.java:223)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
at hudson.Launcher$ProcStarter.start(Launcher.java:509)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:802)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:526)
at hudson.model.Run.execute(Run.java:1900)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:107)
at hudson.model.Executor.run(Executor.java:449)
Caused by: java.io.IOException: error=20, Not a directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 13 more
Finished: FAILURE
原因分析:
网上大多在配置jenkins
的jdk配置
是根据 which java
命令的java路径配置,这个配置路径的java是个文件,而不是文件夹。
[root@k8s-node bin]# which java
/usr/bin/java
解决方案:
更改配置路径文章来源:https://www.toymoban.com/news/detail-555007.html
- 找到java的安装路径,在
/etc/profile
文件中,安装jdk的JAVA_HOME
配置路径
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export JAVA_HOME=/usr/local/jdk-11.0.16.1
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
export MAVEN_HOME=/usr/apache-maven-3.6.3
export PATH=$MAVEN_HOME/bin:$PATH
- 复制上文中的
JAVA_HOME
路径到【系统管理】->【全局工具设置】->【jdk】配置
文章来源地址https://www.toymoban.com/news/detail-555007.html
- 同时解决问题描述中连个问题
到了这里,关于jenkins构建项目-配置JDK的JAVA_HOME路径的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!