Rename package name

Apache 2.0

A recipe that will rename a package name in package statements, imports, and fully-qualified types.

org.openrewrite.java.ChangePackage

Required

The package name to replace.

New package name to replace the old package name with.

Optional

recursiveBoolean

Recursively change subpackage names. Defaults to false, renaming only types directly in oldPackageName; set to true to also rename types in its subpackages.

mod run . --recipe=org.openrewrite.java.ChangePackage \ -P oldPackageName=com.yourorg.foo \ -P newPackageName=com.yourorg.bar

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