问题描述
即使路径存在,我也会收到错误"/var/jenkins_home/tools/hudson.model.JDK/jdk8/bin/java:找不到:".
I'm getting the error "/var/jenkins_home/tools/hudson.model.JDK/jdk8/bin/java: not found:" even though the path exists:
[edi-debatcher_master-LNI22Y2C5V3VECCBCFPVB3ZUWJJNMLK6LIFEQ6V3OYH52T74NU3A@2] Running shell script
+ echo PATH = /var/jenkins_home/tools/hudson.model.JDK/jdk8/bin:/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5.3/bin:/var/jenkins_home/tools/hudson.model.JDK/jdk8/bin:/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
PATH = /var/jenkins_home/tools/hudson.model.JDK/jdk8/bin:/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5.3/bin:/var/jenkins_home/tools/hudson.model.JDK/jdk8/bin:/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
+ echo M2_HOME = /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5.3
M2_HOME = /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5.3
+ mvn -version
/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5.3/bin/mvn: exec: line 199: /var/jenkins_home/tools/hudson.model.JDK/jdk8/bin/java: not found
我正在使用Jenkins Blue Ocean功能GitHub Jenkinsfile.我在全局工具配置中定义了"jdk8"和"Maven 3.5.3",并选中了自动安装".
I am using the Jenkins Blue Ocean feature, GitHub Jenkinsfile. I have "jdk8" and "Maven 3.5.3" defined in Global Tool Configuration, "autoinstall" checked.
这是我的Jenkins文件:
Here is my Jenkinsfile:
pipeline {
agent any
stages {
stage('Initialize') {
steps {
sh '''
echo "PATH = ${PATH}"
echo "M2_HOME = ${M2_HOME}"
mvn --version
'''
}
}
stage('Build') {
steps {
sh 'mvn -Dmaven.test.failure.ignore=true install'
}
post {
success {
junit 'target/surefire-reports/**/*.xml'
}
}
}
}
tools {
maven 'Maven 3.5.3'
jdk 'jdk8'
}
post {
always {
deleteDir()
}
}
}
推荐答案
您正在为系统运行错误版本的文件(此处为java).
You are running a wrong version of the file (here java) for the system.
问题:该文件在那里,无法执行.错误消息是没有这样的文件或目录"
Problem:The file is there and can not be executed. The error message is "No such file or directory"
解决方案:您为系统运行的文件版本错误
例如,如果您使用Alpine Linux在Docker容器中运行Jenkins安装,则可能会出现此问题,因为Alpine使用musl libc. Oracle Java二进制文件仅在glibc上运行.
The problem can occur for example if you run your Jenkins installation in a Docker container with Alpine Linux, since Alpine uses musl libc. The Oracle Java binaries only run on glibc.
这篇关于詹金斯·蓝海(Jenkins Blue Ocean):Maven看不到Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!