IntelliJ IDEA 2021.2 Help

Unload modules

To make IntelliJ IDEA work faster, you can temporary set aside (unload) modules that you don't need at the moment. The IDE ignores the unloaded modules when you search through or refactor your code, or compile your project.

When you unload modules, you do it locally — the information about unloaded modules is not shared through version control.

Manually unload modules

  1. In the Project tool window, right-click a module, and select Load/Unload Modules.

  2. You can double-click a module in the dialog to load or unload it, or use the buttons in the middle of the dialog.

Unloading a module

Automatically load and unload new modules

If your teammates add new modules to a project, you will download them to your computer on the project update. After that, the IDE will analyze the dependencies between all modules in the updated project.

If you have unloaded modules, IntelliJ IDEA will load or unload new modules according to the results of the dependency analysis.

If new modules depend on the existing unloaded modules, the new modules will be marked as unloaded. IntelliJ IDEA will ignore them because otherwise you may face errors when you try to compile them.

Adding new modules to the unloaded module

If existing loaded modules have direct dependencies on new modules, the new modules will be marked as loaded.

Adding new modules to the loaded module

If existing loaded modules have no dependencies on the newly added modules, the new modules will be marked as unloaded. You can manually mark them as loaded as soon as you need them.

Adding new modules to the loaded module with no dependencies

Commit changes with unloaded modules

If you have unloaded modules, and you make changes in files that your unloaded modules depend on, compilation of these modules may fail after you load them back.

To avoid compilation failures of unloaded modules, make sure that the Compile affected unloaded modules option is selected in the Commit Changes dialog.

Before committing changed files, IntelliJ IDEA will compile unloaded modules to make sure that the changes don't affect these modules. The IDE will inform you about the detected errors, and will suggest resolving them before the commit.

Troubleshooting

If modules in your project depend on each other, you may face errors when you unload one or more of them.

For example, if Module 1 depends on Module 2, and you unload Module 2, IntelliJ IDEA won't be able to resolve references to classes in Module 2. Moreover, compilation of Module 1 will probably fail.

To avoid such errors, the IDE analyzes dependencies when you load or unload modules. When you load modules, IntelliJ IDEA will suggest loading all dependencies as well. When you unload modules, the IDE will find all dependent modules and will unload them, too.

Unloading modules

If you unload Module 1, you may not see any errors in code in Module 2, and you will also be able to compile Module 2. However, you may accidentally break compilation of dependant code in Module 1 by making changes in code in Module 2. Since Module 1 is unloaded, you won't be able to see any errors until you load it back and compile.

If you invoke Find Usages Alt+F7 or a refactoring on a class, field, or method Ctrl+Alt+Shift+T, contained in Module 2, the result may be incomplete because the contents of Module 1 are not taken into account. IntelliJ IDEA will inform you about that.

Moreover, the IDE will compile unloaded modules every time you commit changes, and will check that the changes don't affect unloaded modules. See more information in Committing changes with unloaded modules.

Unloading modules
Last modified: 02 August 2022