Remove unused JAXB annotation support from rewrite-maven - #8671
Conversation
The JaxbAnnotationModule was only registered on MavenXmlMapper's writeMapper, while the only JAXB-annotated classes (RawPom and RawGradleModule) are exclusively deserialized. Everything that is serialized through the writeMapper already uses Jackson's native XML annotations. Fixes #8669
|
No rush on getting this through @knutwannheden , but I figured you'd be the best judge of effects on (de)serialization. Seemed OK with a small caveat on the dropped transitive dependency & automatically registered modules. |
|
One caveat worth recording, since it isn't visible in the diff: I checked that nothing else needs them. Scanning the CLI 4.6.3 distribution (its own classes plus all 296 bundled jars), the only classes referencing Two follow-on notes:
|
rewrite-mavendepended oncom.fasterxml.jackson.module:jackson-module-jaxb-annotationsand the pre-Jakartajavax.xml.bindannotations. As suspected in the issue, all of it was dead weight:JaxbAnnotationModulewas only registered onMavenXmlMapper.writeMapper().RawPomandRawGradleModule, carried@XmlRootElement(name = "project")but are exclusively deserialized —RawPomthroughreadMapper()(which never had the module) andRawGradleModulethroughpropertyBasedMapper(a JSON mapper, so the XML root name was inert there regardless).writeMapper()already uses Jackson's native XML annotations:MavenSettings(@JacksonXmlRootElement(localName = "settings")),AddDevelocityMavenExtension's config classes (@JacksonXmlRootElement), andPlugin.getConfiguration(path, Class)which just round-trips aJsonNode.So this drops the dependency, the module registration, and the two annotations.
Verified with
MavenSettingsTest(which asserts the exact serialized XML round-trips to the parsed document),AddDevelocityMavenExtensionTest, andRawPomTest(which covers thewriteMapperpath inPlugin.getConfiguration). The three failures in that local run were all Maven Central HTTP 429s, unrelated to the change.