A library is a collection of compiled code used in your modules as is. For Java, for example, a library is a set of class files stored in an archive or directory (or in a number of archives and directories).
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.
IntelliJ IDEA lets you define the libraries at the global (IDE), project, and module levels. The level of a library defines its usage scope and reusability within the IDE:
- Global libraries can be used in any of your projects.
- 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 can be used only in the corresponding module.
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". Such items will stay in the library but IntelliJ IDEA will ignore them. 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.
You can exclude folders, archives (e.g. JARs) and folders within the archives.
Making the items excluded is a useful alternative to removing them from the library.
In the UI, the excluded library items are shown as .
- Configuring Project and Global Libraries
- Configuring Module Dependencies and Libraries