IntelliJ IDEA 2019.3 Help

Projects

When you create a new project, you have to select a project type, configure an SDK, and specify the project name and location.

You can also specify the necessary settings right in the New Project wizard, so that when you open your project for the first time, it will be pre-configured. For example, the IDE will load libraries and create files. In case of Maven or Gradle, IntelliJ IDEA will define tasks and declare dependencies.

Refer to Create your first Java application for information on how to start developing a Java application in IntelliJ IDEA.

Project formats

In IntelliJ IDEA, there are two types of formats in which a project's configuration can be stored — the file-based format format (legacy) and the directory-based format (default and recommended).

For file-based projects, the IDE creates the .ipr, .iws and .iml files. For projects stored in the directory-based format, the IDE creates the .iml file and the .idea directory that keeps project settings.

The .iml file is created for each module in a project. For more information, refer to Working with modules.

For more information on project formats, you can also refer to How to manage projects under Version Control Systems

Change the project format

  • If you want to change the project's format to directory-based, go to File | Save as Directory-Based Format.

Import a project

To import a project in IntelliJ IDEA, go to File | New | Project from Existing Sources.

In IntelliJ IDEA, you can import a project that comes from Eclipse and Flash Builder. You can also import a collection of source files to create a new project from them.

If you're importing a project that uses build tools such as Maven or Gradle, it's recommended that you import the associated build file pom.xml or build.gradle. In this case, IntelliJ IDEA will recognize the dependencies and artifacts in the project, and will automatically restore their configuration.

For Maven and Gradle projects, consider enabling the Store generated project files externally option in the project import dialog if you share the project through VCS.

Usually, IntelliJ IDEA recreates the .iml file every time you make changes in the descriptor file and these changes get imported. You can avoid placing the .iml file under version control, but in this case some changes in the module configuration won't be shared (such as added facets, for example). With the Store generated project files externally option on, generated files will be stored separately, and you won't have to exclude files from version control.

Share project settings through VCS

Project settings are stored in the project directory as a set of XML files under the .idea folder. This folder contains both user-specific settings that shouldn't be placed under version control and project settings that are normally shared among developers working in a team, for example, the code style configuration.

When you place a project under version control, your personal settings are automatically ignored. IntelliJ IDEA moves workspace.xml — the file with your personal settings — to the list of ignored files to avoid conflicts with other developers' settings.

Configuration files are processed according to your choice. Once you modify the project settings, and a new configuration file is created, the IDE shows a notification at the bottom of the screen prompting you to select how you want to treat configuration files in this project:

  • View files: view the list of created configuration files and select, which of them you want to place under version control. After that, the selected files will be scheduled for addition to VCS.

  • Always Add: silently schedule all configuration files created in the .idea directory for addition to VCS (applies only to the current project).

  • Don't Ask Again: never schedule configuration files for addition to VCS; they will have the unversioned status until you manually add them to VCS (applies only to the current project).

If you close the notification without selecting any option, it will appear again after a new configuration file is created. The new file will also go to the list that will be there until you select one of the options even if you restart the IDE.

Notification prompting to select how to treat                     configuration files

Copy global settings to the project level

Global (IDE) settings are stored separately from projects. That is why, these settings are not shared through version control together with the project.

Some settings, however, can be copied to the project level. For example, you can create a copy of your code style configuration, inspection profiles, the list of classes and packages excluded from code completion and auto-import . If you do so, the IDE creates the corresponding configuration files in the .idea directory that you can share together with the project through VCS.

IntelliJ IDEA also provides several ways of sharing settings between different IDE instances. See Sharing your IDE settings for details.

Last modified: 9 December 2019