jenkins安装 ruby-runtime 插件失败

安装报错
image.png

1java.lang.RuntimeException: unsupported Java version: 11 2 at org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1674) 3 at org.jruby.RubyInstanceConfig.<clinit>(RubyInstanceConfig.java:1387) 4Caused: java.lang.ExceptionInInitializerError 5 at org.jruby.embed.internal.AbstractLocalContextProvider.<init>(AbstractLocalContextProvider.java:42) 6 at org.jruby.embed.internal.SingleThreadLocalContextProvider.<init>(SingleThreadLocalContextProvider.java:43) 7 at org.jruby.embed.ScriptingContainer.getProviderInstance(ScriptingContainer.java:242) 8 at org.jruby.embed.ScriptingContainer.<init>(ScriptingContainer.java:226) 9 at org.jruby.embed.ScriptingContainer.<init>(ScriptingContainer.java:192) 10 at org.kohsuke.stapler.jelly.jruby.JRubyFacet.<init>(JRubyFacet.java:65) 11 at ruby.RubyRuntimePlugin.registerJRubyFacet(RubyRuntimePlugin.java:39) 12 at ruby.RubyRuntimePlugin.start(RubyRuntimePlugin.java:30) 13 at hudson.ClassicPluginStrategy.startPlugin(ClassicPluginStrategy.java:407) 14 at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:396) 15Caused: java.io.IOException: Failed to initialize 16 at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:399) 17 at hudson.PluginManager.dynamicLoad(PluginManager.java:920) 18Caused: java.io.IOException: Failed to install ruby-runtime plugin 19 at hudson.PluginManager.dynamicLoad(PluginManager.java:932) 20 at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:2179) 21Caused: java.io.IOException: Failed to dynamically deploy this plugin 22 at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:2183) 23 at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1846) 24 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) 25 at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 26 at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:121) 27 at java.base/java.lang.Thread.run(Thread.java:829) 28 29

提示是 java 11 版本过高

安装jdk8

1[root@icyops1 ~]# java -version 2java version "1.8.0_311" 3Java(TM) SE Runtime Environment (build 1.8.0_311-b11) 4Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode) 5[root@icyops1 ~]# which java 6/usr/local/java/jdk1.8.0_311/bin/java 7 8 9

修改jenkins的启动文件,指定java路径

1[root@icyops1 ~]# vim /etc/rc.d/init.d/jenkins 2 3………… 4# Search usable Java as /usr/bin/java might not point to minimal version required by Jenkins. 5# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html 6candidates=" 7/usr/local/java/jdk1.8.0_311/bin/java 8/etc/alternatives/java 9/usr/lib/jvm/java-1.8.0/bin/java 10/usr/lib/jvm/jre-1.8.0/bin/java 11/usr/lib/jvm/java-11.0/bin/java 12/usr/lib/jvm/jre-11.0/bin/java 13/usr/lib/jvm/java-11-openjdk-amd64 14/usr/bin/java 15" 16………… 17 18 19

之后重启jenkins即可。

1 [root@icyops1 ~]# systemctl restart jennkins 2 3

代码交流 2021