IntelliJ Platform Gradle Plugin (2.x)
Edit pageLast modified: 24 February 2025Current Release: 2.2.1
GitHub: Releases & Changelog, Issue Tracker
JetBrains Platform Forum: Gradle Build Scripts category
The IntelliJ Platform Gradle Plugin 2.x is a Gradle plugin for building, testing, verifying, configuring environments, and publishing plugins for IntelliJ-based IDEs. It is the successor of Gradle IntelliJ Plugin (1.x) which is no longer under active development.
Learn more about it in the Release Announcement.
tip
Requirements
IntelliJ Platform Gradle Plugin 2.x requires the following minimal versions:
IntelliJ Platform: 2022.3
Gradle: 8.2
See the Gradle Installation guide on how to upgrade.
Java Runtime: 17
See Gradle JVM in Settings | Build, Execution, Deployment | Build Tools | Gradle.
Setup
note
Note that the plugin has a new ID
org.jetbrains.intellij.platform
.
To apply the IntelliJ Platform Gradle Plugin to a project, add the following entry to the plugins
block in the Gradle build file:
plugins {
id("org.jetbrains.intellij.platform") version "2.2.1"
}
plugins {
id 'org.jetbrains.intellij.platform' version '2.2.1'
}
To use the latest snapshot version of this plugin, add the following to the Gradle Settings file:
settings.gradle.kts
pluginManagement {
repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots/")
gradlePluginPortal()
}
}
settings.gradle
pluginManagement {
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
gradlePluginPortal()
}
}
tip
The current IntelliJ Platform Gradle Plugin Snapshot version is
The snapshot release is published with a fixed version, so Gradle can resort to the cached version of the plugin.
To update all dependencies in the dependency cache, use the
--refresh-dependencies
command line option.
Plugins
The IntelliJ Platform Gradle Plugin consists of plugins which can be applied depending on the purpose. By default, the Platform plugin (org.jetbrains.intellij.platform
) should be applied to the main plugin project module.
When working in a Multi-Module Project Structure it is required to use Module plugin (org.jetbrains.intellij.platform.module
) instead of creating tasks and configurations specific to the main module only.
The Settings plugin (org.jetbrains.intellij.platform.settings
) allows for adding plugin development related repositories right in the settings.gradle.kts file if project configuration involves Dependency Resolution Management.
Attaching Sources in the IDE
To attach IntelliJ Platform sources in the IDE, the Download sources setting has to be enabled in IDE versions 2023.2 and later. This option respects the plugin's downloadSources property, which is enabled by default.
In Settings | Advanced Settings enable option Download sources in section Build Tools. Gradle. Then invoke Reload All Gradle Projects action from the Gradle tool window.
In Settings | Build, Execution, Deployment | Build Tools | Gradle enable Download sources for dependencies. Then invoke the Reload All Gradle Projects action from the Gradle tool window.
No additional IDE settings are required.
The attaching sources operation in the IDE is handled by the Plugin DevKit plugin, thus it is recommended to always use the latest available IDE version.
If the opened compiled class has no sources available locally, the Plugin DevKit plugin will detect the relevant source coordinates and provide an action to Download IntelliJ Platform sources or Attach $API_NAME$ sources.
Configuration
tip
Exploring Configuration OptionsAuto-completion, Quick Documentation, and other code insight features are available for many extension functions and properties.
Setting Up Repositories
All IntelliJ Platform SDK artifacts are available via IntelliJ Maven repositories (see IntelliJ Platform Artifacts Repositories), which exist in three variants:
releases
snapshots
nightly (only selected artifacts)
tip
In most cases, the
defaultRepositories()
repository should be enough.
Example:
Setup Maven Central and defaultRepositories()
repositories:
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
Example #2:
Build a plugin against a release version of the IntelliJ Platform with dependency on a plugin from the JetBrains Marketplace:
repositories {
mavenCentral()
intellijPlatform {
releases()
marketplace()
}
}
repositories {
mavenCentral()
intellijPlatform {
releases()
marketplace()
}
}
See Repositories Extension on how to configure additional repositories.
Dependency Resolution Management
To access the IntelliJ Platform Gradle Plugin within the Gradle Settings file to use with dependencyResolutionManagement
, add:
settings.gradle.kts
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
plugins {
id("org.jetbrains.intellij.platform.settings") version "2.2.1"
}
dependencyResolutionManagement {
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
}
settings.gradle
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
plugins {
id 'org.jetbrains.intellij.platform.settings' version '2.2.1'
}
dependencyResolutionManagement {
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
}
Cache Redirector
Some repositories, by default, point to JetBrains Cache Redirector to provide better resource resolution. However, it is possible to use the direct repository URL, if available.
To switch off the default usage of JetBrains Cache Redirector, see the useCacheRedirector Gradle property.
Setting Up IntelliJ Platform
Dependencies and repositories are handled using explicit entries within dependencies {}
and repositories {}
blocks in the Gradle build file.
A minimum configuration for targeting IntelliJ IDEA Community 2023.3:
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity("2023.3")
}
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity('2023.3')
}
}
The intellijIdeaCommunity
in the previous sample is one of the extension functions available for adding IntelliJ Platform dependencies to the project. See Dependencies Extension on how to target other IDEs.
note
When declaring a dependency on IntelliJ Platform, the IDE installer is resolved by default. IDE installers are OS-specific and contain JetBrains Runtime (JBR) bundled, but have no EAP releases available.
To resolve EAP releases instead, opt-out from installer releases with
useInstaller = false
passed to the dependency helper.Important: non-installer archives have no JetBrains Runtime (JBR) provided.
Read more about Target Versions.
Parametrize IntelliJ Platform Dependency
As a fallback, intellijPlatform
extension can be used to allow dynamic configuration of the target platform, for example, via gradle.properties:
platformType = IC
platformVersion = 2023.3
The above Gradle properties can be referenced in the Gradle build file with:
dependencies {
intellijPlatform {
val type = providers.gradleProperty("platformType")
val version = providers.gradleProperty("platformVersion")
create(type, version)
}
}
dependencies {
intellijPlatform {
def type = providers.gradleProperty('platformType')
def version = providers.gradleProperty('platformVersion')
create(type, version)
}
}
The intellijPlatform
helper accepts also the IntelliJPlatformType
type:
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
dependencies {
intellijPlatform {
val version = providers.gradleProperty("platformVersion")
create(IntelliJPlatformType.IntellijIdeaUltimate, version)
}
}
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
dependencies {
intellijPlatform {
def version = providers.gradleProperty('platformVersion')
create(IntelliJPlatformType.IntellijIdeaUltimate, version)
}
}
Local IntelliJ Platform IDE Instance
It is possible to refer to the locally available IntelliJ-based IDE using the local
helper function:
repositories {
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
local("/Users/user/Applications/IntelliJ IDEA Ultimate.app")
}
}
repositories {
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
local '/Users/user/Applications/IntelliJ IDEA Ultimate.app'
}
}
tip
localPlatformArtifacts() and defaultRepositories()Note that unless using recommended default
defaultRepositories()
, thelocalPlatformArtifacts()
entry needs to be added to therepositories {}
block explicitly to use local dependencies (bundled plugins, local IDE, custom plugin repositories, etc.).
Setting Up Plugin Dependencies
To specify a dependency on a plugin, it is important to distinguish bundled plugins from plugins available in JetBrains Marketplace.
The Dependencies Extension provides a set of helpers to manage plugin dependencies:
repositories {
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity("2024.3.3")
bundledPlugin("com.intellij.java")
plugin("org.intellij.scala", "2024.1.4")
}
}
repositories {
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '2024.3.3'
bundledPlugin 'com.intellij.java'
plugin 'org.intellij.scala', '2024.1.4'
}
}
tip
localPlatformArtifacts() and defaultRepositories()Note that unless using recommended default
defaultRepositories()
, thelocalPlatformArtifacts()
entry needs to be added to therepositories {}
block explicitly to use local dependencies (bundled plugins, local IDE, custom plugin repositories, etc.).
Multi-Module Project Structure
When working on a complex plugin, it is often convenient to split the code base into multiple submodules. To avoid polluting submodules with tasks or configurations specific to the root module only (for example, tasks for signing, publishing, or running the plugin), a dedicated sub-plugin was introduced.
The root module of the IntelliJ-based plugin project must apply the main Platform plugin as follows:
plugins {
id("org.jetbrains.intellij.platform") version "2.2.1"
}
plugins {
id 'org.jetbrains.intellij.platform' version '2.2.1'
}
Any other included submodule must use the Module plugin instead:
plugins {
id("org.jetbrains.intellij.platform.module")
}
plugins {
id 'org.jetbrains.intellij.platform.module'
}
note
Something missing?If a topic you are interested in is not covered in the above sections, let us know via the Was this page helpful? feedback form below or other channels.
Please be specific about the topics and reasons for adding them, and leave your email in case we need more details. Thanks for your feedback!
Thanks for your feedback!