On this tab, you can define the module SDK and form the list of module dependencies.
- Main settings and controls
- Context menu commands for dependency items
- Sorting the list of dependencies
Main settings and controls
Select the module SDK. (To associate the project SDK with the module, select Project SDK. Note that if you change the project SDK later, the module SDK will change accordingly.)
If the desired SDK is not present in the list, click New and select the necessary SDK type. Then, in the dialog that opens, select the SDK home directory and click OK.
To view or edit the name and contents of the selected SDK, click Edit. (The SDK page will open.)
List of dependencies
Shown below the module SDK is the list of module dependencies. Use ,, , and to add, remove and reorder the items (libraries and modules). Use the cells in the header row to sort the list, seeSorting the list of dependencies.
When you compile or run your code, the list of dependencies is used to form the classpath for the compiler or JVM. (Native Library Locations, if any, are added to
Scope. This setting lets you control the classpath separately for your sources and test sources, and for the build and the run phases. (The classpath may be different when 1) your sources are compiled 2) your test sources are compiled 3) your compiled sources are run 4) your tests are run. The Scope option defines the classpaths in which the dependency is to be included.)
Select the necessary option from the list:
The following table summarizes the classpath information for the possible dependency scopes.
Note that IntelliJ IDEA is different from some other build tools (for example Gradle and Maven) in the way it processes dependencies for test sources. If your module (module A) depends on another module (module B), IntelliJ IDEA assumes that the test sources in the module A depend not only on the sources in the module B but also on its test sources. Consequently, the test sources of B are also included in the corresponding classpaths.
Export. This option lets you control the compilation classpath for the modules that depend on this one.
Select the checkbox if you want the item to be exported as a dependency along with the module. That is, if there is a module that depends on this one, the items with the Export option on will be included in the compilation classpath of the dependent module.
Note that this setting doesn't affect the runtime classpath. At runtime, all the dependencies of the current module are included in the classpath for the modules that depend on this module.
Also note that the dependency scopes may change when exported. For example:
If L has the Export option on, then the scope of the dependency of A on L will effectively be Test.
This and also some other interesting practical cases are listed in the following table.
Controls for working with the dependencies
Alt+Insert. Use this icon or shortcut to add a library or a module to the list of the module dependencies. Select one of the following options:
Alt+Delete. Use this icon or shortcut to remove the selected item or items from the list of dependencies.
Alt+Up and Alt+Down. Use these icons and shortcuts to move the selected item up or down in the list. See Module dependencies.
F4. Use this icon or shortcut to open the Configure Library dialog to edit the library.
Dependency storage format
Select the format for storing the dependencies (as an IntelliJ IDEA module, or as Eclipse project). This option is helpful for the teams that use different development tools.
Context menu commands for dependency items
For a library: use this command to edit the selected library. (The Configure Library dialog will open.)
Use this command to remove the selected item or items from the list of dependencies.
Use this command or shortcut to see details for the selected item. An appropriate page of the Project Structure dialog will open, if any.
Use this command to see the list of modules where the selected dependency is used. Clicking a module in that list, opens the Module Page for the corresponding module.
Analyze This Dependency
Use this command to perform a dependency analysis for the selected item and display the results in the Dependency Viewer.
Move to Project Libraries or Move to Global Libraries
For a module library: Use this command to move the selected library to a higher level (project or global).
Copy to Module Libraries
For a global or project library: Use this command to create a copy of the selected library at the module level.
Sorting the list of dependencies
You can sort the dependencies by their names and scopes by clicking the cells in the header row.
If you click a cell once, the list is sorted by the corresponding column in the ascending order. The sorting marker appears in the cell: . When you click the cell for the second time, the information is sorted in the descending order. To show this, the sorting marker changes its appearance: . Finally, when you click the cell for the third time, the initial unsorted state is resorted.
Note that the sorting operations don't change the actual order of dependencies.
When the list is sorted, the icons for changing the order of dependencies are inactive.