一。JDK版本
当前k8s部署的jenkins版本为2.387.1 默认使用的是jdk11
当mvn编译jdk1.8版本项目时会出问题
如提示:
Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
此时需要使用插件JDK Parameter 注意当前1.2版本插件有xss漏洞问题,记得更新
此前已经配置了
![]()
在构建项目中添加参数化构建
![]()
此时返回构建也会有如图
![]()
点击开始构建即可
可以看到构建控制台输出日志
Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 ERROR: ================================================================================ ERROR: [JENKINS-18403][JENKINS-28294] JDK 'jdk1.8_201' not supported to run Maven projects. ERROR: Maven projects have to be launched with a Java version greater or equal to the minimum version required by the controller. ERROR: Use the Maven JDK Toolchains (plugin) to build your maven project with an older JDK. ERROR: Retrying with agent Java and setting compile/test properties to point to /var/jenkins_home/jdk1.8.0_201. 依然会提示版本错误,但是会使用我们配置的jdk进行重试。
二、settings.xml配置
如下图,在build菜单下,选择高级,指定自己的setting.xml配置文件
![]()
乐享:知识积累,快乐无限。