Commit 56b280c
authored
Retain javax.xml.bind:jaxb-api when jackson-module-jaxb-annotations is present (#987)
* Retain javax.xml.bind:jaxb-api when jackson-module-jaxb-annotations is present
When migrating from javax.xml.bind to jakarta.xml.bind 3.0+, the
ChangeDependency recipe replaces javax.xml.bind:jaxb-api entirely.
However, jackson-module-jaxb-annotations still depends on the
javax.xml.bind namespace at runtime through its transitive dependency
on jakarta.xml.bind:jakarta.xml.bind-api:2.3.x (the bridge version).
When version resolution upgrades to 3.0.x+, the javax.xml.bind classes
disappear, causing NoClassDefFoundError.
This adds a RetainJaxbApiForJackson recipe that re-adds
javax.xml.bind:jaxb-api as a runtime dependency when
jackson-module-jaxb-annotations is detected on the classpath,
for both Gradle and Maven projects.
Fixes #504
* Update recipes.csv with RetainJaxbApiForJackson
* Replace imperative recipe with declarative YAML, use actual() in tests
Address PR feedback:
- Replace imperative RetainJaxbApiForJackson.java with declarative YAML
recipes using FindDependency preconditions (split into Gradle and Maven
variants since ModuleHasDependency is a ScanningRecipe which doesn't
work as a declarative precondition)
- Use assertThat().actual() instead of return in test assertions
* Update recipes.csv for new declarative recipes
* Consolidate into single declarative recipe using DependencyInsight precondition
Replace the Gradle/Maven split with a single declarative recipe that uses
DependencyInsight as a cross-platform precondition instead of build-system
specific FindDependency recipes.1 parent 0c1793f commit 56b280c
File tree
3 files changed
+243
-5
lines changed- src
- main/resources/META-INF/rewrite
- test/java/org/openrewrite/java/migrate/jakarta
3 files changed
+243
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
| 832 | + | |
832 | 833 | | |
833 | 834 | | |
834 | 835 | | |
| |||
858 | 859 | | |
859 | 860 | | |
860 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
861 | 886 | | |
862 | 887 | | |
863 | 888 | | |
| |||
0 commit comments