IntelliJ IDEA 2022.2 Help

Migrate

The Migrate refactoring lets you easily switch between the old packages and classes used in your project and the new ones. IntelliJ IDEA comes with the default migration map.

Run the migration refactoring

  1. From the main menu, select Refactor | Migrate Packages and Classes.

  2. Select the desired migration map from the list.

  3. In the dialog that opens, select the scope of file in which you want to refactor your code and click Run.

    Running the migration refactoring

Create a new migration

  1. From the main menu, select Refactor | Migrate Packages and Classes, and click Create New Migration.

  2. Specify the name of the map and an optional map description.

  3. Click the Add icon to create a new migration rule.

  4. In the dialog that opens, specify the following options:

    • Select whether you want to migrate packages or classes.

    • Specify the old and the new names of the package or class.

    Click OK to apply changes and close the dialog.

  5. Create or edit as many migration rules as required. Use the App actions edit icon to edit the exiting rules.

  6. Click Save. After than, you can run it from the main menu.

Last modified: 29 November 2022