Configuring

The first time you open IntelliJ, an initial configuration wizard will be shown to you. This wizard will ask you which technologies you want to enable or disable, then it will pick plugins or a group of dependent plugins. It is recommended that you just enable the plugins that you will use because the more plugins you have enabled, the more time is spent in starting the IDE. Also, you can enable or disable any plugin when you want, in the settings dialog.

The majority of the time, you won't need to configure anything in IntelliJ. For example, if your project uses a Git repository, when you open the project in IntelliJ, it will configure its VCS tool automatically based on the Git's files present in the Git folder. Even if it is necessary to configure something, you will probably see a balloon on the upper-right corner indicating the event and a link which will direct you to the place where you can take action.

Anyway, all configurations are done in the settings dialog. Even when you see options in the context menus or in balloons, they are just shortcuts to sections of the settings dialog. You will also see them in some tabs and buttons used to configure it, but they are shortcuts too.

As you finish the initial configuration, IntelliJ will open the initial window where you can do some actions, such as creating a project or configuring the IDE. In this initial window, you can open the Settings window (or by pressing Ctrl + Alt + S on Windows or command + , on Mac when in the main IntelliJ window). In the Settings window, you will see various items, some of which are specific for the plugins you have enabled, others that are used to configure the entire IDE, and others for project configuration. They are divided in two big sections: Project Settings and IDE Settings.

The Project Settings section is used to change configurations in the IDE that are specific to the current project, such as the compiler, deployment, and VCS. On the other hand, the IDE Settings section is the place where you will manage the configurations that will impact all current and future projects you have, such as Plugins, Notifications, and Keymap. Navigating through the items of the settings window is really simple, but some of them are hidden in a tree structure, which makes it difficult to find them when we need. Fortunately, this can be solved using the search box, as shown in the following screenshot. As I mentioned before, searches are available in practically all IDE elements.

Configuring

Project Structure

This dialog is used to configure the structure of the project and can be opened by clicking on the Project Structure button present in the main window or using the shortcut Ctrl + Alt + Shift + S (or command + ; in Mac). It's divided into the following five categories:

  • Project: This section is used to configure the general settings for the project, such as project name, the Java version used, the language level, and the path for the compiled output.
  • Modules: This module is a discrete elementary unit of the functionality which you can compile, run, test, and debug independently. In this section, you can configure settings that are specific to each module in the project, such as the dependencies, package's prefix, and paths.
  • Libraries: This section is used to manage the libraries used in the project. Even if the libraries are managed by an external tool, such as Maven, they can be managed in this category.
  • Facets: Facets represent various frameworks, technologies, and languages used in a module. Here, you can manage the facets of the module. This way, you can define if the support for a particular framework is enabled for it (for example, Spring). Once a facet is activated in a module, IntelliJ will provide facilities to work with that facet.
  • Artifacts: An artifact is a draft that defines the layout of the project output. It could be an archive (JAR, WAR, EAR) or a directory. In other words, an artifact defines what the final output of the project will be. In this section, you can configure the properties for the artifact of the project.

The following sections in the chapter are two other categories related to Platform Settings: SDKs and Global Libraries.

Virtual machine options

Perhaps someday you will notice that IntelliJ may be running slow; this may happen, for example, when your project has lots of classes. To avoid this, we could increase the available memory used by IntelliJ. Simply edit the file INTELLIJ_FOLDER/bin/idea.vmoptions (or INTELLIJ_FOLDER inidea.exe.vmoptions on Windows). What you discover upon opening this file are the virtual machine options used to run IntelliJ; so, if you want to change other things related to Java VM, which executes IntelliJ, this is the place to do so.

You should take care while changing or adding options in this file. Depending on the options you use here, the speed of IntelliJ could get worse. For example, setting values very high for the arguments -Xms and -Xmx can make garbage collector decrease its performance. On the other hand, very small values could create an OutOfMemoryError in IntelliJ. You can use the memory usage indicator to help you to configure these arguments. It is localized in the bottom-right corner of the IDE. If the bar indicates that it is using almost the total reserved memory (for example, using 235 MB of 256 MB), it is recommended that you increase the memory reservation argument by at least 500 MB, as shown in the following screenshot:

Virtual machine options

Migrating from another IDE

If you are a user of another IDE (for example, Netbeans or Eclipse), you will notice that some differences exist in IntelliJ that could make you go crazy when using this IDE.

  • The nomenclature—the name of a feature in another IDE is probably different from that in IntelliJ (for example, project in Eclipse is the same as module in IntelliJ).
  • IntelliJ saves the files automatically, so if you try to close the file to get the old content, it won't work; in this case you can use the History tab.
  • The shortcuts are different. You can change the keymaps (the relation between the shortcut and the action), although there are predefined keymaps for Eclipse and Netbeans users. A better approach is learning from scratch.
  • IntelliJ IDEA compiles files only when it's needed to save system resources for other tasks. IntelliJ is smart enough to know which files have changed, so it recompiles just what is needed. However, if you still want to make IntelliJ compile on every save, you can use the EclipseMode plugin.
  • It doesn't have the deploy-on-save feature. However, you can use the On frame deactivation option available in the dialog or, perhaps, you can use other options, such as the JRebel plugin for IntelliJ.
  • In the other IDEs the user can open multiple projects in one window; in IntelliJ a window is tied with only one project.

The JetBrains website provides complete lists of FAQs. for Netbeans at http://confluence.jetbrains.com/display/IntelliJIDEA/IntelliJ+IDEA+for+NetBeans+Users and Eclipse's users at http://confluence.jetbrains.com/display/IntelliJIDEA/IntelliJ+IDEA+for+Eclipse+Users, which can help you perform the transition to IntelliJ more easily.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.35.255