IntelliJ IDEA 14.0.0 Web Help

Configuring Module Dependencies and Libraries

On this page:

See also, Dependencies, Library and Configuring Project and Global Libraries.

Creating a module library and adding it to module dependencies

  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
  2. In the left-hand pane of the dialog, select Modules.
  3. In the pane to the right, select the module of interest.
  4. In the right-hand part of the dialog, on the Module page, select the Dependencies tab.
  5. On the Dependencies tab, click add and select Jars or directories.
  6. In the dialog that opens, select the necessary files and folders. These may be individual .class and .java files, directories and archives (.jar and .zip) containing such files as well as directories with Java native libraries (.dll, .so or .jnilib). Click OK.
  7. If necessary, select the Export option and change the dependency scope.
  8. Click OK in the Project Structure dialog.

Adding existing libraries to module dependencies

  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
  2. In the left-hand pane of the dialog, select Modules.
  3. In the pane to the right, select the module of interest.
  4. In the right-hand part of the dialog, on the Module page, select the Dependencies tab.
  5. On the Dependencies tab, click add and select Library.
  6. In the Choose Libraries dialog, select one or more libraries and click Add Selected.

    The libraries you can choose from include:

    • Global libraries
    • Project libraries existing in the current project
    • Application server libraries for the servers registered in IntelliJ IDEA
  7. If necessary, select the Export option and change the dependency scope.
  8. Click OK in the Project Structure dialog.

Creating a module, project or global library and adding it to module dependencies

  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
  2. In the left-hand pane of the dialog, select Modules.
  3. In the pane to the right, select the module of interest.
  4. In the right-hand part of the dialog, on the Module page, select the Dependencies tab.
  5. On the Dependencies tab, click add and select Library.
  6. In the Choose Libraries dialog, click New Library.
  7. If suggested, select:
    • Java to create a Java library. Select the files and folders to be included in the library in the dialog that opens.
    • From Maven to download a Java library from a public Maven repository. Specify the artifact to be downloaded and the associated settings in the Download Library from Maven Repository dialog.
  8. In the Configure Library dialog:
    1. Specify the library name.
    2. Select the library level (global, project or module).
    3. Configure the library contents using add, iconLibExclude and delete.
    4. Click OK.
  9. In the Choose Libraries dialog, click Add Selected.
  10. If necessary, select the Export option and change the dependency scope.
  11. Click OK in the Project Structure dialog.

Creating a library in the Project tool window

  1. Open the Project tool window (e.g. View | Tool Windows | Project ).
  2. Select the .jar file or files to be included in the library, or a directory that contains the .jar files of interest.
  3. Select Add as Library from the context menu.
  4. In the Create Library dialog, specify the library name, level and the module in which this library will be used.

Adding dependencies on modules

  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
  2. In the left-hand pane of the dialog, select Modules.
  3. In the pane to the right, select the module of interest.
  4. In the right-hand part of the dialog, on the Module page, select the Dependencies tab.
  5. On the Dependencies tab, click add and select Module Dependency.
  6. In the Choose Modules dialog, select one or more modules the current module should depend on, and click OK. (Your selection is limited to the modules of the current project. That is, you cannot select the modules from a different project.)
  7. If necessary, select the Export option and change the dependency scope.
  8. Click OK in the Project Structure dialog.

Changing the order of dependencies

Sorting the list of dependencies

Configuring the library contents

  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
  2. In the left-hand pane of the dialog, select Modules.
  3. In the pane to the right, select the module of interest.
  4. In the right-hand part of the dialog, on the Module page, select the Dependencies tab.
  5. On the Dependencies tab, select the library of interest, and click edit1.
  6. In the Configure Library dialog that opens, use add, iconLibExclude and delete to manage the library contents.
  7. Click OK in the Project Structure dialog.
11.0+

Moving a module library to the project or global level

  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
  2. In the left-hand pane of the dialog, select Modules.
  3. In the pane to the right, select the module of interest.
  4. In the right-hand part of the dialog, on the Module page, select the Dependencies tab.
  5. On the Dependencies tab, right-click the library of interest, and select Move to Project Libraries or Move to Global Libraries.
  6. In the Move Library dialog, if necessary, edit the library name. If you want to change the location of the library files, select the Move library files to check box and specify the corresponding location.

Downloading missing library sources from the Maven repository

See Also

Last modified: 4 December 2014
comments powered by Disqus