Add an API dependency for explicit imports

MSAL

Add an API dependency to the nearest Maven module importing the package, including imports whose types could not be resolved by the parser because the JDK used to provide them. A module that already has the API in the needed scope, or from a dependency it declares as provided, is left alone.

org.openrewrite.java.migrate.javax.AddApiDependencyForImports

Required

The package whose imports need the API. A jakarta package also matches imports of its javax predecessor.

The group ID of the API dependency.

The artifact ID of the API dependency.

The version of the API dependency to add.

mod run . --recipe=org.openrewrite.java.migrate.javax.AddApiDependencyForImports \ -P packageName=jakarta.xml.bind \ -P groupId=jakarta.xml.bind \ -P artifactId=jakarta.xml.bind-api \ -P version=3.0.x

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.