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 (
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.
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 application server resources (classes) in your modules.
When you add a definition of an application server in IntelliJ IDEA, the corresponding 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 .