An Introduction to Projects, Modules, and Libraries
This is an attempt to make sense of the different new terms related to
project configuration. I may be way off on some points so feel free to
A Project contains a number of settings (editable in the Project Properties
dialog), and a number of modules (editable in the Configure Project dialog).
Project files are stored in the project directory and have the extension ipr.
A Module is a set of classes with the same output directory. A Module contains
one or more Content Entries, where each entry has Source Folders and Test Source
Folders. Source Folders contain the source code for the Module classes. The
Test Source Folders contain source code to test classes that are used to test
the Module classes.
A Module can have a separate Test output path where all test class files are
put. This together with the Test Source Folders keep the test files separate
from the distributable files.
Module definitions are stored in files with the extension iml, for example
printing.iml. The module definition files are stored in the project directory.
Modules can be reused between projects, but the current version has many
limitations. One is that there is no GUI to accomplish this. Another is that
a module cannot be opened by more than one project at a time. A third limitation
is that modules cannot have their own Version Control Sustem (VCS) configuration.
The VCS configuration is part of the project settings.
Libraries are read-only references to classes that you want to use in your
modules/projects. You cannot modify the classes of a Library from within
a project that uses the library.
Application libraries (Global libraries)
Named libraries created as Application libraries are available in other projects.
Named libraries created as Project libraries are available only in this project.
Module libraries are not available for reuse by any other project or module.
They just provide a way to refer to prebuilt classes.
What to do of all this? What is the recommended way to set up a project?
You have a base directory where you put all your projects. Let's say c:\projects.
In this directory you put your different project directories. For example:
In a project directory you put the project file and a directory for each of
In a module directory, you have a class output path and a test class output
path. You also have a Content Entry with a Source folder and a Test Source Folder.
For every class that you add in a src directory you (should) add a test class in the
To deploy your application, you pull together the files in all classes directories to
a single directory or a single jar file. You may also put each separate classes directory
in its own jar file.