IntelliJ Concepts
External
Internal
Settings
There are three type of settings in IntelliJ IDEA: module settings, project settings and global settings.
Global Settings
Global settings apply to all projects of a specific installation of IntelliJ IDEA. Such settings include IDE appearance, themes, color schemes, the set of installed and enabled plugins, debugger settings, global inspection profile, list of Global SDKs, etc. On Mac, the global settings are maintained under the IntelliJ configuration path.
UI access to global settings is done through IntelliJ IDEA → Preferences. Settings that are NOT marked with the are global and apply to all existing projects.
Configuration Path
See Configuration Path below.
Paths and Files
'Applications' Path
/Applications/JetBrains Toolbox.app/Contents
/Applications/IntelliJ IDEA 2021.2 EAP.app/Contents
Also see:
IntelliJ Home
Toolbox Installation
For IntelliJ instances installed with "Toolbox":
$HOME/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0 ├─ .history.json ├─ .channel.settings.json ├─ 203.7148.57 │ └─ ... └─ 211.7442.40 ├─ IntelliJ IDEA.app.vmoptions └─ IntelliJ IDEA.app └─ Contents ├─ CodeResources ├─ Info.plist ├─ bin │ └─ ├─ lib │ └─ ├─ plugins │ └─ ├─ jbr │ └─ ├─ help │ └─ ├─ Resources │ └─ ├─ ... └─ MacoOS └─ idea
Aslo see:
.history.json
Contains a top level history
list that has a history of "actions" such as "install" and "update" applied to the local IntelliJ instances (IDEA-U and Community apps). Each action has a timestamp. Each action applies to an "item". This file can be used in fact as a configuration entry point for an IntelliJ installation (item.intellij_platform.default_config_directories['idea.plugins.path']
). It can also be used to determine the "active" IntelliJ installations:
{
"history": [
{
"action": "update",
"item": {
"id": "IDEA-U",
"name": "IntelliJ IDEA Ultimate",
"version": "2021.1.2",
"major_version": {
"name": "2021.1",
"order_value": 211000
},
"build": "211.7442.40",
"released": "2021-06-01T00:00:00Z",
"description": "...",
"order_value": 100000,
"icon_url": "...",
"home_url": "...",
"home_url_i18n": { ... },
"quality": {
"description": "For the prudent. A stable version with reliable performance",
"name": "Release",
"order_value": 10000,
"description_i18n": { ... },
},
"whats_new": { ... },
"supported_languages": [ ... ],
"licensing": { ... },
"package": {
"os": "mac",
"type": "dmg",
"url": "https://download.jetbrains.com/~urlswitch/idea/ideaIU-2021.1.2.dmg?fromJetBrainsToolbox",
"size": ...,
"checksums": [ ... ],
"requirements": { ... }
},
"post_install": { ... },
"uninstall": {
"feedback": { ... },
"activation": { ... },
"intellij_platform": {
"product_code": "IU",
"vmoptions": "Contents/bin/idea.vmoptions",
"vmoptions_content": "-Xms128m\n-Xmx750m\n...\n",
"user_vmoptions_path": "%HOME%/Library/Preferences/IntelliJIdea2021.1/idea.vmoptions",
"incompatible_vmoptions": [ ... ],
"shell_script_name": "idea",
"config": [ ... ],
"default_config_directories": {
"idea.system.path": "$HOME/Library/Caches/JetBrains/IntelliJIdea2021.1",
"idea.config.path": "$HOME/Library/Application Support/JetBrains/IntelliJIdea2021.1",
"idea.log.path": "$HOME/Library/Logs/JetBrains/IntelliJIdea2021.1",
"idea.plugins.path": "$HOME/Library/Application Support/JetBrains/IntelliJIdea2021.1/plugins"
},
"java_path": "Contents/jbr/Contents/Home/bin/java"
}
},
"timestamp": "2021-06-08T20:56:19.675104-07:00"
},
...
]
}
IntelliJ System Path
The IntelliJ installation maintains state on filesystem under (adjust for IntelliJ version) its system directory:
$HOME/Library/Caches/JetBrains
├─ IntelliJIdea2020.3
│ └─ ...
└─ IntelliJIdea2021.1
├─ LocalHistory
│ └─ ...
├─ caches
│ └─ ...
├─ compile-server
│ └─ ...
├─ compiler
│ └─ ...
├─ plugins
│ └─ ...
├─ ...
└─ workspace
└─ ...
The path can be looked up as the value of the idea.system.path
system property, and its default value can be found in .history.json
file. The directory includes a caches
subdirectory.
IntelliJ Configuration Path
The global settings are maintained under (adjust for IntelliJ version):
$HOME/Library/Application Support/JetBrains
├─IntelliJIdea2020.3
│
└─IntelliJIdea2021.1
├─ extensions
│ └─ ...
├─ workspace
│ └─ ...
├─ plugins
│ └─ ...
└─ options
├─ jdk.table.xml
├─ ...
The path can be looked up as the value of the idea.config.path
system property, and its default value can be found in .history.json
file.
IntelliJ Log Path
See:
IntelliJ Plugin Path
See Plugin Path below.
Project
A project is a directory that keeps everything that makes up the application. A typical project has a set of settings and one or several modules. The project provides a mechanism to express dependencies between modules and stores modules' shared configuration.
.idea Directory
The .idea directory is used by IntelliJ to store project settings metadata, and it is collocated with the project. It lives by default under the project's root. It contains the following directories and files:
User-Specific Settings
workspace.xml
Stores user-specific settings.
tasks.xml
User Dictionaries
Maintained in .idea/dictionaries/username.xml.
shelf
datasources.xml
In IDEA 13 or earlier, datasources.xml contains user passwords.
libraries
All XML files under .idea/libraries will be generated by the Gradle or the Maven project.
gradle.xml
Gradle settings. Also see Gradle Support below.
vcs.xml
misc.xml
The file declares the "ProjectRootManager" component. For a Java project, the component which defines the Project SDK, which is a JDK, as reflected in the project-jdk-type
element, and the languageLevel
:
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="corretto-11" project-jdk-type="JavaSDK"/>
...
</project>
These are some recommendations on what to share and what not to share in a SVC system. The article applies to Git, but the rules are generally valid:
Project Settings
The project settings apply to the current project. They are stored together with other project files in the .idea directory in an XML format. Project settings are VCS settings, SDKs, code style, spellchecker settings, compiler output, libraries. All these setting are available to all the modules of the project.
A project has just one Project SDK that is initially the default SDK for all modules. However, module-specific SDKs can be configured.
TODO:
- https://www.jetbrains.com/help/idea/configure-project-settings.html
- https://www.jetbrains.com/help/idea/project-settings-and-structure.html
Module
A module is a logical group of source code and resources within a project.
The module has an .iml file that keeps the internal representation of the module settings. The module is also associated with a module content root directory, which stores the source code, tests and resources. The .iml file and the module content root are not tied, they can exists in different locations on the file system.
.iml File
The .iml file keeps the internal representation of the module settings.
Module Settings
Module settings apply only to one module and they are stored in the module's .iml file.
As part of its settings, a module declares the Module SDK. By default, the module SDK is the same as the Project SDK, but the module may choose a Module SDK and a language level that are different from those configured for the enclosing project. A module can also have its own libraries. A module can also carry a specific technology or framework.
TODO: https://www.jetbrains.com/help/idea/configure-modules.html
Grouping Modules
Debugging
Suspending Only One Thread, and Not All
Right-click on the breakpoint → Suspend → Thread
Optional: Make Default.
SDK
A SDK (Software Development Kit) is a collection of tools needed to develop application for a specific software framework. An SDK contains binaries, source code for the binaries, documentation and, in Java's case, annotations. For Java, a JDK (Java Development Kit) is needed.
SDK Hierarchy
Global SDKs
In general, an SDK is global, meaning that one SDK configured on the IntelliJ instance can be used in multiple projects and modules. Even if the SDKs are global, the access to the global SDKs is done via a projects: File → Project Structure → Platform Settings → SDKs. The available SDKs are listed there. The list of Global SDKs per IntelliJ installation is stored in ~/Library/Application Support/JetBrains/IntelliJIdea2021.1/options/jdk.table.xml
(path should be adjusted for a specific IntelliJ version). Note that the file is incorrectly named "jdk.*", the file contains the list of all SDKs available to the IntelliJ installation (Python, etc.)
To add a global SDK, the same project interface should be used. The SDK is added by clicking "+".
How to programmatically add a SDK?.
Project SDK
A project has one SDK (the "Project SDK"), which is part of the Project Settings. The Project SDK can be found at File → Project Structure → Project Settings → Project → Project SDK. The UI provides controls that allow associating a Global SDK with the project: the SDK can be then chosen from a list of global SDKs. The project SDK is the default SDK for all modules, but module-specific SDKs can then be configured on a module-by-module basis.
The Project SDK definition is maintained in the project's .idea directory, in the misc.xml file.
Module SDK
By default, the modules of a project inherit the project SDK. Individual modules can be configured to use different SDKs with File → Project Structure → Project Settings → Modules → Select a module → Dependencies → Module SDK.
SDK Documentation
JDK
A JDK is a package that contains libraries, tools for developing and testing Java applications and tools for running applications on the Java platform (JRE - Java Runtime Environment). A JRE alone is not suitable for development, as it does not have essential development tools such as compilers and debuggers.
IntelliJ comes with its own bundled JRE, which executes the IDE, but that JRE is not suitable for development. A fully featured JDK must be downloaded and installed.
Indexing
Cache
The top-level cache directory: /Users/ovidiu/Library/Caches/JetBrains/IntelliJIdea2021.1/caches
, under the IntelliJ system path.
Cache Types
Project Cache
Workspace Cache
External Build System Cache
Compiler Cache
Compile Server Cache
Cache Invalidation
Main Menu → File → Invalidate Caches...
Local History
Maintained on disk in /Users/ovidiu/Library/Caches/JetBrains/IntelliJIdea2021.1/LocalHistory
.
Gradle Support
Build
Incremental Build
IntelliJ supports incremental builds that significantly speeds up the building process.
Compile Server
When the IDE is configure to build a project by itself, as opposite to delegating the building to Gradle, for example, it start a compile server, which is a separate Java process that drives the compiler. The compiler may be javac, the eclipse compiler, or others.
The compile server process looks similar to:
java \
-Xmx21000m \
-Djava.awt.headless=true \
-Djdt.compiler.useSingleThread=true \
-Dexternal.project.config=/Users/ovidiu/Library/Caches/JetBrains/IntelliJIdea2021.1/external_build_system/<project>.93c0766d \
-Dcompile.parallel=true \
-Drebuild.on.dependency.change=true \
-Didea.paths.selector=IntelliJIdea2021.1 \
-Didea.home.path=/Users/ovidiu/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents \
-Didea.config.path=/Users/ovidiu/Library/Application Support/JetBrains/IntelliJIdea2021.1 \
-Didea.plugins.path=/Users/ovidiu/Library/Application Support/JetBrains/IntelliJIdea2021.1/plugins \
-Djps.log.dir=/Users/ovidiu/Library/Logs/JetBrains/IntelliJIdea2021.1/build-log \
-Djps.fallback.jdk.home=/Users/ovidiu/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/jbr/Contents/Home \
-Djps.fallback.jdk.version=11.0.11 \
-Dio.netty.noUnsafe=true \
-Djava.io.tmpdir=/Users/ovidiu/Library/Caches/JetBrains/IntelliJIdea2021.1/compile-server/xx_bc046e03/_temp_ \
-Djps.backward.ref.index.builder=true \
-Djps.track.ap.dependencies=false \
-Dtmh.instrument.annotations=true \
...
-classpath /Users/ovidiu/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/plugins/java/lib/jps-launcher.jar:/Users/ovidiu/.../eclipse-compiler/ecj-4.19.jar
org.jetbrains.jps.cmdline.Launcher \
/Users/ovidiu/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/lib/jdom.jar:... \
org.jetbrains.jps.cmdline.BuildMain \
127.0.0.1 63186 ec0c5130-7288-4233-b333-995c7db7beb0 /Users/ovidiu/Library/Caches/JetBrains/IntelliJIdea2021.1/compile-server
The compile server logs diagnostic information in the build.log:
For more details about build delegation configuration see:
Compile Server Settings
The compiler server settings are a per-project settings, NOT global settings. They are maintained in the IntelliJ project configuration directory .idea
in the compiler.xml
file.
Plugins
Plugin Path
The IntelliJ installation maintains plugin state on filesystem under (adjust for IntelliJ version):
~/Library/Application Support/JetBrains/IntelliJIdea2021.1/plugins
The path can be looked up as the value of the idea.plugins.path
system property, and its default value can be found in .history.json
file. The directory is found under the IntelliJ configuration path subdirectory.
Environment Variables
Path Variables
IntelliJ has a few Pre-defined path variables, but additional path variables can be defined in Preferences → Appearance & Behavior → Path Variables.
Pre-Defined Path Variables
USER_HOME
PROJECT_DIR
The directory where the project is stored.