自2017 年以来,Jenkins 放弃了对 Java 7 的支持,现在开始使用 Java 8。
我正在尝试在 Debian Jessie(docker 容器)上安装 Jenkins,并且我正在使用通过此链接获得的以下过程:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
在程序的最后一步,发生了这样的事情:
$ apt-get install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
jenkins : Depends: default-jre-headless (>= 2:1.8) but 2:1.7-52 is to be installed or
java8-runtime-headless but it is not installable
E: Unable to correct problems, you have held broken packages.
我在这里找到了解决方案:
$ apt install -t jessie-backports openjdk-8-jre-headless ca-certificates-java
无论如何,我设法安装了 Jenkins,但是当启动 Jenkins 时,会发生这种情况:
$ sudo /etc/init.d/jenkins start
[FAIL] Starting Jenkins Automation Server: jenkins failed!
$ tail -f /var/log/jenkins/jenkins.log
Jenkins requires Java8 or later, but you are running 1.7.0_151-b01
from /usr/lib/jvm/java-7-openjdk-amd64/jre
java.lang.UnsupportedClassVersionError: 51.0
at Main.main(Main.java:124)
例如,我是否必须将 Java 8 安装到 Debian Jessie?
我发现有导致冲突的 JRE 包。
前:
删除包:
后:
启动詹金斯:
加: