fix: declare explicit dependency on jackson-annotations2-api#151
Closed
M0Rf30 wants to merge 1 commit into
Closed
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
jackson2-api 2.19+ split jackson-annotations out into a separate jackson-annotations2-api Jenkins plugin. Because the jfrog plugin only declared a dependency on jackson2-api, Jenkins loaded JsonInclude$Include through two independent PluginClassLoaders, triggering a LinkageError (loader constraint violation) in BuildInfoExtractorUtils.createMapper when JfStep was initialized on controllers running jackson2-api 2.19 or newer. Declaring jackson-annotations2-api explicitly adds it to the generated Plugin-Dependencies manifest entry so the annotation classes are resolved through the same loader jackson2-api uses. Fixes #150
3abf107 to
70618ab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a
java.lang.LinkageError(loader constraint violation) that preventsJfStepfrom initializing on Jenkins controllers runningjackson2-api2.19 or newer.Problem
Starting with
jackson2-api2.19, the plugin was split:jackson-annotationswas moved into a separatejackson-annotations2-apiJenkins plugin. Thejfrogplugin still declares a dependency only onjackson2-api, socom.fasterxml.jackson.annotation.JsonInclude$Includeis visible toBuildInfoExtractorUtilsvia onePluginClassLoaderand toObjectMapper.setSerializationInclusion(...)via another.When
JfStep.<clinit>callsBuildInfoExtractorUtils.createMapperthe JVM sees two differentClassobjects for the same FQN and refuses method resolution:Fix
Declare
io.jenkins.plugins:jackson-annotations2-apiexplicitly inpom.xml. Themaven-hpi-pluginthen emits it inside thePlugin-Dependenciesmanifest entry so Jenkins delegates annotation class loading through the same loaderjackson2-apiuses.The dependency is pinned because the current
bom-2.462.xdoes not managejackson-annotations2-apiyet.Verification
Rebuilt plugin. The resulting HPI manifest now contains both plugin dependencies:
After installing the patched HPI on the affected controller the
LinkageErrorno longer occurs andjfpipeline steps run as before.Fixes #150
Test plan
jackson2-api>= 2.19tools { jfrog 'jfrog-cli' }and confirmJfStepinitializes without aLinkageError