Java Reference
In-Depth Information
Work in
IDEA
begins with the concept of a project. A project encapsulates all your
source code, library files, and build instructions into a single organizational unit.
Since version 4.0,
IDEA
's modules and libraries let you segregate larger, complex
projects in more manageable structures that can share common code. Modular-
ized projects are also a great benefit when you're building enterprise applications
composed of several different components with complex interdependencies.
Even if you've used an older version of
IDEA
extensively, we recommend that you
not skip this chapter due to the fundamental changes in project management.
4.1 Understanding IDEA's project strategy
When you work on source code in
IDEA
, you do so in the context of a
project
.
Because everything in
IDEA
revolves around the project, it's important to have a
firm understanding of how and why
IDEA
handles projects the way it does.
4.1.1
Examining the IDEA project hierarchy
If you've never used an integrated development environment (
IDE
) like
IDEA
before, you may not immediately understand why you have to define a project
before diving into your work. Remember, however, that
IDEA
isn't a simple text
editor; it's a Java development environment. As such, you can't just start typing in
your source code willy-nilly. First you have to create a project.
What is a project?
A project in
IDEA
is an organizational unit that represents a complete software
solution. Your finished product may be decomposed into a series of discrete, iso-
lated modules, but it's a project definition that brings them together, relates them
with dependencies, and ties them into a greater whole.
Projects don't themselves contain development artifacts such as source code,
build scripts, or documentation. They're the highest level of organization in the
IDE
, and they define project-wide settings as well as collections of what
IDEA
refers to as
modules
and
libraries.
What is a module?
A
module
in
IDEA
is a discrete unit of functionality that can be run, tested, and
debugged independently. Modules contain the development artifacts for their
specific task; this includes such things as source code, build scripts, unit tests,
documentation, and deployment descriptors.
IDEA
supports different types of
modules, from plain Java applications to web apps,
EJB
modules, and so on. For
many projects, a single module will suffice.