Closed kwin closed 3 years ago
Was there a particular reason why jersey2
was used as library (https://github.com/adobe/aio-lib-java-cloudmanager/blob/8ad4eab0363fdc02a95681a729878d48bc53ab8e/pom.xml#L131). To me it seems that the default http client + json parser okhttp-gson
could be less conflicting, as it doesn't require JAX RS 2.0.
The classpath in Jenkins seems to be a mess. A similar issue was reported in https://issues.jenkins.io/browse/JENKINS-44378. I am still unsure which plugin include JAX-RS 1.x or whether this is provided by the Jenkins Core.
Jersey2 was used as I was most familiar with it.
This issue seems to be specific to using the library in the context of Jenkins. While it is a/the primary use case for this, it is an issue related to that context, and not necessarily something that this project needs to resolve.
As a side note, from the Jenkins documentation:
While possible, accessing third-party libraries using @Grab from trusted libraries has various issues and is not recommended.
Seems as if Jenkins context is unlikely to work using the @Grab
notation regardless.
When you recommend using an external binary one could use the aio-cli in the first place. I would still say that executing this library inside a Jenkins Shared Library should be supported (deploying an external tool requires some effort). Let me try to come up with a fix which relies on shading and relocation
Just for the reference: The Groovy Shared Library uses a class loader which merges all plugin classloaders. This is a parent class loader of the Grapes class loader and therefore used preferably. In my case it was the JIRA Trigger Plugin which included Jersey Core 1.5 (which includes javax.ws.rs.core..MultivaluedMap
from JAX-RS 1.x). After that plugin was removed, it works.
I use the client in a Jenkins Shared Library via
When trying to get the token I run into the following exception
The reason for that is that the Java library requires JAX-RS 2.0.0 while Jenkins still seems to ship with JAX-RS 1.1.0 (or older): https://stackoverflow.com/a/44070033.