A new update: after Oleg recommended I try the SlocCount plugin, I did. And it does fail as expected on Java 11 by default. I filed
JENKINS-55620 to track this.
So then I tried dropping directly jaxb-api-2.3.0.jar and jaxb-core-18.104.22.168.jar into various locations to see how it behaves. Everything worked fine.
To summarize, it seems like hardcoding the dependency against JAXB directly in the plugin would be simpler. I'm not saying it will work in every single case, where/if a given plugin does something more convoluted, trying for instance to use JAXB instances coming from another plugin (which I think, but untested yet, would result in having the classes seen as different given classloaders would be different).
Circling back to my previous point, and adding up to Jesse's comment above:
which plugins would actually be affected? It is maybe a five-line change to switch the thread context loader¹, and it would be nice to get JAXB out of core if we could.
- I think I provided some data about "which plugins would actually be affected?": the answer is likely "very few" or something along this.
- "get JAXB out of core": given my testing on sloccount-plugin, I think this is possible.
Now, I'm aware I've not tested the whole Jenkins ecosystem, but so I'm still wondering if this subject is as prevalent as we were imagining. I guess, again, the fact many fixes were pushed already makes this less and less of an issue.
I'm eager to hear what people think.