What is the difference between "Module Dependencies" and "Libraries" in IntelliJ IDEA?

Module dependencies are classes, archives, libraries and resources that your module files references. While a library is a set of class files stored in an archive or directory.

Export check means if checked then this library will be implicitly added to the other module that references this one.

To create a .jar file you need create an artifact. Artifact is a placeholder of the building output. There's predefined templates for creating .jar, .war, .ear archives. You can choose jar to build a jar artifact. By default it's defined empty and you need to define content of the artifact. You can drag-n-drop compiled output to it but don't do it with library archives. Because libraries in this case will be packaged inside the .jar file and you will be required to create a separate classloader to load them before your application start. Instead you change the artifact type to Other and drag .jar and dependent libraries into output root. This way library archives will be copied along with created .jar. You also need to create a MANIFEST.MF and specify Class-Path there for dependent libraries. All files will be stored in the directory you specify for building the artifact. You can build it using Build Artifact menu.


If your project contains multiple modules, "module dependency" defines dependencies between these modules, but libraries are compiled classes (usually jar files, optionaly containing theirs sources and javadocs) that are used by your module.

Each module can have its own libraries and artifacts (for example a result jar file), and can depend on other modules without circular dependency.


Module Dependencies tab can contain Libraries, Export means that a library from the module will be also available to another module that depends on this module.

Final jar with all the dependencies can be created using Artifacts.