Add missing AddDependency entries for all javax-to-jakarta migrations#1033
Merged
steve-aom-elliott merged 3 commits intomainfrom Mar 30, 2026
Merged
Add missing AddDependency entries for all javax-to-jakarta migrations#1033steve-aom-elliott merged 3 commits intomainfrom
steve-aom-elliott merged 3 commits intomainfrom
Conversation
96da398 to
89946be
Compare
Many recipes in JavaxMigrationToJakarta used ChangeDependency + ChangePackage but lacked AddDependency. When the javax dependency is only available transitively (not declared explicitly in the build file), ChangeDependency finds nothing to change while ChangePackage still renames imports, leaving unresolvable jakarta references. This adds AddDependency entries to 21 recipes, matching the pattern already used by JavaxServletToJakartaServlet, JavaxMailToJakartaMail, and JavaxAnnotationMigrationToJakartaAnnotation.
…ion, and inject Verifies that AddDependency fires when the javax dependency is only available transitively and not declared explicitly in the build file. Each test uses a Maven project with only spring-boot as a dependency and source code importing a javax type, asserting that the correct jakarta API dependency is added to the pom.
The tests verify that AddDependency fires when javax types are used in source but no explicit dependency is declared, not necessarily that the dependency exists transitively. Rename to 'WhenNoExplicit*DependencyDeclared' to accurately describe the customer scenario.
89946be to
3bf4a42
Compare
timtebeek
approved these changes
Mar 30, 2026
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
AddDependencyas a fallback whenChangeDependencyhas nothing to change) to all 21 remaining javax-to-jakarta migration recipes injakarta-ee-9.yml.ChangeDependencyfinds nothing to change whileChangePackagestill renames imports, leaving unresolvablejakarta.*referencesJavaxJspToJakartaJsp.JavaxServletToJakartaServlet,JavaxMailToJakartaMail, andJavaxAnnotationMigrationToJakartaAnnotationalready hadAddDependencyentries.Test plan
org.openrewrite.java.migrate.jakarta.*)AddDependencyfires when no explicit javax dependency is declared