IntelliJ IDEA 2016.1 Help

Library

A library is a collection of compiled code used in your modules as is. A Java library, for example, can include class files, archives and directories with class files as well as directories with Java native libraries (.dll, .so or .jnilib).

Libraries may optionally include the source code for the library classes as well as corresponding API documentation. Including the source files and documentation is optional and doesn't alter the way the library is used in any way. However, it adds the ability to use inline documentation extracted from the source code, and also to view the API documentation right from the IDE.

Library levels

You can define the libraries at the global (IDE), project, and module levels. The level of a library defines its usage scope:

  • Global libraries can be used in any of your projects. That is, they can be added to dependencies of any module in any project.
  • Project libraries can be used in any of the modules within the corresponding project. However, they are not available outside of the project in which they are defined.
  • Module libraries exist only as dependencies of the corresponding module.

IntelliJ IDEA lets you move the libraries to a higher level (e.g. from project to global), create library copies at a lower level (e.g. you can create a copy of a global library at the project level), etc.

Application server libraries

Application server libraries let you use classes available in corresponding server distributions.

When you add a definition of an application server in IntelliJ IDEA, normally, an associated application server library is created.

In terms of the library levels, the application server libraries are global libraries. They can be added to dependencies of any module in any of your projects.

Excluded library items

You can make library items "excluded". IntelliJ IDEA will ignore such items when you write your code. As a result, the classes from excluded packages won't be present in code completion suggestion lists, references to such classes will be shown in the editor as unresolved, etc. However, when you compile or run your code, a library is still used as a whole, irrespective of whether there are excluded items in that library or not.

You can exclude folders, archives (e.g. JARs) and folders within the archives.

When your code references only a small portion of a big library, making the "unnecessary" items excluded may considerably increase the IDE performance.

In the UI, the excluded library items are shown as rootExcluded.

See Also

Last modified: 13 July 2016