Skip to content

Add missing AddDependency entries for all javax-to-jakarta migrations#1033

Merged
steve-aom-elliott merged 3 commits intomainfrom
add-missing-jakarta-add-dependency
Mar 30, 2026
Merged

Add missing AddDependency entries for all javax-to-jakarta migrations#1033
steve-aom-elliott merged 3 commits intomainfrom
add-missing-jakarta-add-dependency

Conversation

@steve-aom-elliott
Copy link
Copy Markdown
Contributor

@steve-aom-elliott steve-aom-elliott commented Mar 30, 2026

Summary

  • Follow-on to Add missing AddDependency for jakarta.servlet.jsp-api in JSP migration #1032. Applies the same fix (adding AddDependency as a fallback when ChangeDependency has nothing to change) to all 21 remaining javax-to-jakarta migration recipes in jakarta-ee-9.yml.
  • When a javax dependency is not explicitly declared in the build file (e.g. provided by a container or via flat-dir jars), ChangeDependency finds nothing to change while ChangePackage still renames imports, leaving unresolvable jakarta.* references
  • Add missing AddDependency for jakarta.servlet.jsp-api in JSP migration #1032 (now merged) fixed this for JavaxJspToJakartaJsp. JavaxServletToJakartaServlet, JavaxMailToJakartaMail, and JavaxAnnotationMigrationToJakartaAnnotation already had AddDependency entries.
  • This PR extends the fix to: activation, authentication, authorization, batch, validation, decorator, EJB, EL, enterprise/CDI, inject, interceptor, JMS, JSON, JWS, persistence, resource, security, transaction, websocket, XML bind, and XML SOAP

Test plan

  • All existing Jakarta tests pass (org.openrewrite.java.migrate.jakarta.*)
  • Added test coverage for persistence, transaction, validation, and inject verifying AddDependency fires when no explicit javax dependency is declared

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Mar 30, 2026
@steve-aom-elliott steve-aom-elliott force-pushed the add-missing-jakarta-add-dependency branch 3 times, most recently from 96da398 to 89946be Compare March 30, 2026 16:32
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.
@steve-aom-elliott steve-aom-elliott force-pushed the add-missing-jakarta-add-dependency branch from 89946be to 3bf4a42 Compare March 30, 2026 16:36
@steve-aom-elliott steve-aom-elliott moved this from In Progress to Ready to Review in OpenRewrite Mar 30, 2026
@steve-aom-elliott steve-aom-elliott marked this pull request as ready for review March 30, 2026 16:52
@steve-aom-elliott steve-aom-elliott merged commit bef57d1 into main Mar 30, 2026
1 check passed
@steve-aom-elliott steve-aom-elliott deleted the add-missing-jakarta-add-dependency branch March 30, 2026 17:44
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request test provided

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants