jenkins-rest
jenkins-rest copied to clipboard
Support JDK17
Expected Behavior
I'd like some confidence that this library supports JDK17
Current Behavior
Unclear if this supports. but based on travis.yml we seem to have removed running against JDK17 due to some library incompatibility. https://github.com/cdancy/jenkins-rest/commit/737a770adb675818cc3988a4e33aa5230136dc7c
Context
I'm considering to upgrade Spring Boot 3 when its ready, and Spring Boot 3 will not support < JDK17. https://spring.io/blog/2022/05/24/preparing-for-spring-boot-3-0
So it'll be key to have this library ready for JDK17
Steps to Reproduce (for bugs)
Your Environment
@choweiyuan that was due to a plugin related reason for the build itself and not anything to do with jdk17. Things should just work unless anyone has spotted a reason it doesn't.
Below initialization fails with Spring Boot 2.7.x JenkinsClient.builder().endPoint(jenkinsHost).credentials(jenkinsUser:jenkinsToken).build();
Works well with 2.6.x though
@fatihhguvenn can you share the exact error message and a small example of how to reproduce?
@martinda here is an example project jenkinsExc.zip
- It's a gradle project and needs to be built before run.
- It's a Spring Boot project and src\main\java\com\je\jenkinsExc\JenkinsExcApplication.java should be run
- JenkinsClient needs static String fields to be set properly in src\main\java\com\je\jenkinsExc\JenkinsService.java
When it is run Exception is thrown from JenkinsClient
-Edit: sorry i forgot to add the error message. It produces many exceptions, here is the last one below:
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:576) ~[guice-5.1.0.jar:na]
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:190) ~[guice-5.1.0.jar:na]
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:113) ~[guice-5.1.0.jar:na]
at com.google.inject.Guice.createInjector(Guice.java:87) ~[guice-5.1.0.jar:na]
at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:405) ~[jclouds-core-2.5.0.jar:2.5.0]
at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:328) ~[jclouds-core-2.5.0.jar:2.5.0]
at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:651) ~[jclouds-core-2.5.0.jar:2.5.0]
at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:643) ~[jclouds-core-2.5.0.jar:2.5.0]
at com.cdancy.jenkins.rest.JenkinsClient.createApi(JenkinsClient.java:85) ~[jenkins-rest-1.0.1.jar:1.0.1]
at com.cdancy.jenkins.rest.JenkinsClient.<init>(JenkinsClient.java:72) ~[jenkins-rest-1.0.1.jar:1.0.1]
at com.cdancy.jenkins.rest.JenkinsClient$Builder.build(JenkinsClient.java:221) ~[jenkins-rest-1.0.1.jar:1.0.1]
at com.je.jenkinsExc.JenkinsService.init(JenkinsService.java:18) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ~[spring-beans-5.3.23.jar:5.3.23]
... 17 common frames omitted
@cdancy any developments here?
I also get an error when instanticiating a JenkinsClient.
I am using :
Java : 17 Sprng Boot : 2.7.11 Jenkins Server : 2.401 (same with 2.400) Jenkins Rest : 1.0.2
Code :
JenkinsClient client = JenkinsClient.builder()
.endPoint("${JENKINS_URL}")
.credentials("${username}:${password}")
.build();
SystemInfo systemInfo = client.api().systemApi().systemInfo();
Exception :
com.google.inject.CreationException: Unable to create injector, see the following errors:
1) [Guice/ErrorInCustomProvider]: NoSuchMethodError: com/google/gson/internal/ConstructorConstructor
Full stack trace enclosed.
Any help is appreciated. Thanks in advance.
The issue is no longer reproduced when the dependency is declared with "all" classifier as suggested by cdancy on another issue.
<dependency>
<groupId>io.github.cdancy</groupId>
<artifactId>jenkins-rest</artifactId>
<version>1.0.2</version>
<classifier>all</classifier>
</dependency>
@kevin-uslu that is correct path forward here. Recent JDK releases change things a bit and so to get around that you really need to use the all
classifier with is just an uber-jar with all dependencies baked in.