Java Reference
In-Depth Information
location of the module file you're creating. In addition, however, it wants the loca-
tion of the module's content root folder.
The module's content root folder is the folder that contains all the files that
make up the module, including Java source files, Ant files, scripts, resources, and
other related files. In the next step, you'll have the chance to specify a subfolder
of your module's content root folder for source code.
By default,
IDEA
creates your new module's content root folder as a subdirec-
tory of your project's root folder, based on the module's name. You can change
the location manually or by clicking the ellipsis button to select an alternate loca-
tion. Likewise,
IDEA
assumes that you want your module's
IML
file to be located
in the content root folder, but you can change this by clicking the
Change Direc-
tory
button.
Although it isn't required, the default project/module layout is recom-
mended. Keeping your modules contained within their projects not only
helps you stay better organized but also makes sharing them with others
easier, because it eliminates absolute path problems. This approach also
makes it easier to check your entire project into your source control sys-
tem. One exception is situations where you're sharing modules between
several projects, in which case it may make sense to locate modules above
the project level.
TIP
Specifying the Java source folder
IDEA
needs to identify the root of the folder (or folders) that contain your Java
source files. In the
Add Module Wizard
dialog shown in figure 4.11, you're
required to specify the subfolder that contains them. This folder path is relative to
your module's content root folder, and
IDEA
will create it if it doesn't already exist.
This folder forms the root of your Java package hierarchy. You can direct
IDEA
to use an existing source directory by clicking the ellipsis button and navigating
the directory browser to the right location. If you want to specify additional
source folders, you can do so through the project's
Paths
settings, discussed a lit-
tle later.
You don't have to store your sources in a subfolder: You can enter a period (.)
as your source path to mark the entire content root folder as a source folder. Of
course, this means any auxiliary files are mixed in with your Java source files,
which can make things confusing.
If you don't want to specify a source directory, or you aren't ready to create it
now (you can always add it later), select the
Do not create source directory
option.