February 23, 2019
Hot Topics:

Managing Projects with IntelliJ IDEA

  • June 9, 2006
  • By Duane K. Fields, Stephen Saunders & Eugene Belyaev
  • Send Email »
  • More Articles »

Managing project settings

Along with its global settings and preferences, IDEA maintains a collection of settings specific to each project you define. These settings define not only the project's contents and behavior but also related information such as your source code control settings and compiler behavior. You can access these settings by

Figure 3: Step 3 of the New Project Wizard lets you choose between a single-module and a multimodule project.

selecting File | Settings, by using the shortcut Ctrl+Alt+S, or by clicking the Settings icon in the main toolbar (the wrench and machine nut). Doing so brings up the Settings control panel, shown in figure 4. The project-specific categories for the currently active project are shown at the top of the panel; global IDE settings are listed in the lower half.

The project-specific options that you can specify include defining the list of modules involved in the project, the compiler to use for building the project (and some of its options), the version control system configuration for the project, the code style to which the project adheres, and a few options controlling the behavior of the IDEA GUI Designer.

Configuring paths

The Paths settings panel is the main control panel for configuring your project. However, as you can see in figure 5, this control panel is sparse when no modules are present (you'll see another screenshot of this window shortly with modules in it, for comparison). This is because the modules, not the project, manage the development artifacts like source folders, dependent libraries, and so forth. The module list lets you add and remove modules from the project; it's discussed in the next section.

Figure 4: The Settings window lets you control project-specific settings as well as general IDE settings. The two categories are separated for convenience, as shown here.

Figure 5: The Paths window lets you control a few project-specific settings, as shown here, but it's principally used to configure the paths of the project's included modules.

The first option allows you to select between absolute and relative paths. If a module, library, or other referenced file is located outside the project file's directory, IDEA uses either the absolute path or the relative path (relative to the project file) to reference them, depending on which option you've selected in the project's path options. For files within the project directory, relative paths are always used to make project files as portable as possible between machines. This setting is also available on a module-by-module basis, should that become necessary. The other setting lets you to configure the language level for the project. The default language level is 1.3, but you can use 1.4 or 1.5. Language level 1.4 enables the assert keyword, introduced in JDK 1.4. By default, Java compilers disable this keyword, because it wasn't a reserved keyword prior to JDK 1.4 and may cause conflicts with older source code. Similarly, language level 1.5 enables some of the new JDK 1.5 features, such as the enum keyword and autoboxing. If you alter the language level, you must restart IDEA in order for the option to take affect.

Configuring compiler settings

The Compiler settings panel lets you control build-related options such as whether to generate warnings, passing additional parameters to the compiler, and so forth.

Configuring version control settings

The Version Control settings panel lets you integrate your version control system with your project. Because this is a project-level setting, you're free to use different source code control systems for different project or tweak the behavior of each from project to project. Note that IDEA also maintains a set of global settings for version control shared from project to project, such as the location of your source code repository. These settings are also accessed via this panel.
Configuring project code style settings

The Project Code Style settings panel lets you override the code layout and formatting styles used for this project. IDEA maintains a detailed set of code formatting options that are shared between projects unless overridden through this panel. The Code Style settings let you specify everything from the size of your indents to the spacing around method calls and operator symbols.

Configuring GUI Designer settings

The options in the GUI Designer settings panel pertain to IDEA's GUI Designer tool, which makes building user interfaces in Swing relatively painless.

Configuring project template defaults

When you create a new project, the initial settings are based on project template settings maintained by IDEA. To edit these settings, select the File | Template Project Settings command to reveal a subset of the Settings panel (figure 6). IDEA lets you specify default settings for the compiler, version control, code style, and GUI designer options. Once set, all new projects begin with these default settings.

Saving your project settings

IDEA automatically saves project settings, so there is no need (or opportunity) to explicitly save your project. The newly defined settings are applied immediately, so you don't need to restart IDEA or close and reopen project to make them effective.

Reopening a project

When you start IDEA, it automatically reopens the last project you worked on, unless you've disabled the Reopen last project on startup option under IDEA's General settings. You can open an existing project by selecting the File | Open Project command and selecting the IPR file corresponding to your project. Or, if

Figure 6: The Template Project Settings window lets you specify defaults for most project-specific settings. These defaults are applied to all new projects you create.

you've used the project recently, it's listed in the File | Reopen submenu, which maintains a list of the most recently used projects.

Working with multiple projects

When you attempt to work on a project while one is already open, IDEA asks if you wish to open the project in a new frame. If you want to work on multiple projects simultaneously, click Yes. Otherwise, click No to close your existing project and open the new one.

When you open multiple projects, each is loaded in its own IDEA frame. The two projects are completely independent; other than letting you cut and paste between the application windows, they can't share data. To close a project, select the File | Close Project menu option.


Regardless of how many projects you have open at once, only a single instance of IDEA is running, so all open projects must share the same memory space. You may need to bump up the amount of memory allocated to IDEA if you plan to frequently have multiple projects open at once.

Working with project files

IDEA stores the configuration data for projects and their components in plaintext XML files, making it easy to manage, edit, and share project configuration data with others. IDEA creates three different types of files: the project file, the workspace file, and the module file.

Project files have an .IPR extension and contain information core to the project itself, such as the names and location of its component modules, compiler settings, Ant configurations, and so forth. You can click an .IPR file to launch the project in IDEA. By default, this file is created at the root of the project. Along with each project file, IDEA creates an .IWS file to store your personal workspace settings. This file remembers the placement and positions of your windows, your VCS and History settings, your Run/Debug configuration targets, and other data pertaining to the development environment. This file is always created alongside your project file. If this file is deleted, it's regenerated automatically, unlike the project .IPR file.

Module files are created for each module you defined and have the .IML extension. The module file stores all the path and dependency information associated with the module. Its exact contents depend on what type of module it is. By default, module files are located in the module's content root folder.


Project configuration and management is an important aspect of software design, and any worthy IDE provides functionality to address this need. Without it, an engineer may as well be writing software in a plain text editor. The creators of IDEA have invested much thought and effort into making the project-management feature set within their IDE support the needs of their audience.

IDEA uses the concepts of projects, modules, and libraries to decompose the traditional concept of a software project. Projects are the highest level; they equate roughly to the products you're trying to produce. Modules are wholly contained subcomponents-individually buildable, runnable, and testable-that can be assembled into a larger solution. Libraries are static modules that aren't dynamically built or altered but that can be leveraged within the context of a module. By defining these layers and making them self-contained and modular (as Java components are touted to be), software designers can begin to reuse code in multiple projects and also manage that task with a minimum of effort.

About the Authors

Duane K. Fields is a software developer and manager. He co-authored Manning's best-selling Web Development with JavaServer Pages.
Stephen Saunders is a software engineer with experience in knowledge management, financial services, and data management.
Eugene Belyaev is the cofounder, president, and chief technology officer of JetBrains, the company that created IDEA.

About the Book

IntelliJ IDEA in Action
By Duane K. Fields, Stephen Saunders, Eugene Belyaev

Published: March, 2006, Paperback: 450 pages
Published by Manning Publications
ISBN: 1932394443
Retail price: $44.95
This material is from Chapter 4 of the book.

Page 2 of 2

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date