IntelliJ Platform Plugin SDK Help

Dependencies Extension

IntelliJ Platform Gradle Plugin enhances the dependencies {} configuration block by applying a nested dependencies.intellijPlatform {} extension.

This class provides methods for adding dependencies to different IntelliJ Platform products and managing local dependencies.

It also includes methods for adding plugins (including bundled), JetBrains Runtime, as well as tools like IntelliJ Plugin Verifier and Marketplace ZIP Signer.

Example:

  • setup Maven Central and defaultRepositories()

  • target IntelliJ IDEA Community 2024.1.4

  • add dependency on the bundled Java plugin

  • add IntelliJ Plugin Verifier, Marketplace ZIP Signer CLI, and code instrumentation tools

  • add JUnit4 test dependency

  • add Test Framework for testing plugin with JUnit4

repositories { mavenCentral() intellijPlatform { defaultRepositories() } } dependencies { intellijPlatform { intellijIdeaCommunity("2024.1.4") bundledPlugin("com.intellij.java") pluginVerifier() zipSigner() instrumentationTools() testFramework(TestFrameworkType.Platform) } testImplementation("junit:junit:4.13.2") // other dependencies, e.g., 3rd-party libraries }

Target Platforms

Default Target Platforms

See Custom Target Platforms for non-default targets.

Function

Description

androidStudio(version, useInstaller = true)

Android Studio

aqua(version, useInstaller = true)

Aqua

clion(version, useInstaller = true)

CLion

datagrip(version, useInstaller = true)

DataGrip

dataspell(version, useInstaller = true)

DataSpell

fleetBackend(version, useInstaller = true)

Fleet Backend

gateway(version, useInstaller = true)

Gateway

goland(version, useInstaller = true)

GoLand

intellijIdeaCommunity(version, useInstaller = true)

IntelliJ IDEA Community

intellijIdeaUltimate(version, useInstaller = true)

IntelliJ IDEA Ultimate

mps(version, useInstaller = true)

MPS

phpstorm(version, useInstaller = true)

PhpStorm

pycharmCommunity(version, useInstaller = true)

PyCharm Community

pycharmProfessional(version, useInstaller = true)

PyCharm Professional

rider(version, useInstaller = true)

Rider

rubymine(version, useInstaller = true)

RubyMine

rustrover(version, useInstaller = true)

RustRover

webstorm(version, useInstaller = true)

WebStorm

writerside(version, useInstaller = true)

Writerside

Custom Target Platforms

Function

Description

create(type, version, useInstaller = true)

Adds a configurable dependency on the IntelliJ Platform. See Parametrize IntelliJ Platform Dependency.

create(notation, useInstaller = true)

Adds a configurable dependency on the IntelliJ Platform. See Parametrize IntelliJ Platform Dependency.

local(localPath)

Adds a dependency on a local IntelliJ Platform instance. See Local IntelliJ Platform IDE Instance.

See also:

Target Versions

The IntelliJ Platform Gradle Plugin allows for using two types of IntelliJ Platform artifacts for development: installers and multi-OS ZIP archives. Both have advantages and drawbacks, but in the 2.x releases, installers are now the default choice when setting up the project.

Installers

When declaring a dependency on IntelliJ Platform, the IDE installer is resolved by default. The IntelliJ Platform installer is the IDE final distribution used by end-users for installing and running IDE in their machines. Those artifacts are resolved from JetBrains Download CDN (download.jetbrains.com) or Android Studio CDN.

repositories { intellijPlatform { defaultRepositories() } } dependencies { intellijPlatform { IntellijIdeaCommunity("2024.1.4") } }

The listing of all present installers can be resolved with updates XML files for JetBrains IDEs and Android Studio as well as by executing the printProductsReleases task.

IntelliJ Platform installers are OS-specific and contain bundled JetBrains Runtime (JBR), but are limited to public releases only. Installers are always used when running the verifyPlugin task to perform the binary compatibility checks.

To apply required repositories, use Default Repositories or explicit IntelliJ Platform Installers helpers.

Multi-OS Archives

It is still possible to use Multi-OS ZIP archives resolved from IntelliJ Maven Repositories.

To enable resolving this kind of artifacts, opt-out from the installer dependencies by adding useInstaller = false argument to helpers described in Target Platforms, like:

repositories { intellijPlatform { defaultRepositories() jetbrainsRuntime() } } dependencies { intellijPlatform { IntellijIdeaCommunity("2024.1.4", useInstaller = false) jetbrainsRuntime() } }

The Multi-OS Archives don't bundle JetBrains Runtime (JBR) needed to run the IDE locally, perform testing, and other crucial operations. Therefore, it is required to explicitly add a dependency on JetBrains Runtime (JBR) by adding extra jetbrainsRuntime() repository and dependency entries.

It is advised to rely on installer releases, but targeting EAP multi-OS archives helps when making sure your plugin will work in the upcoming IDE releases.

To apply required repositories, use Default Repositories or explicit IntelliJ Maven Repositories helpers.

Plugins

Function

Description

pluginModule(dependency)

Adds a dependency on a plugin module to be bundled within the main plugin JAR, when working on a multi-module project. Requires passing an existing dependency, like: pluginModule(implementation(project(":submodule")))

bundledPlugin(id)

Adds a dependency on a bundled IntelliJ Platform plugin.

bundledPlugins(ids)

Adds dependencies on bundled IntelliJ Platform plugins.

plugin(id, version, group)

Adds a dependency on a plugin for IntelliJ Platform. The group parameter can define a plugin release channel, like @eap or a full Maven coordinates group.

plugin(notation)

Adds a dependency on a plugin for IntelliJ Platform using a string notation:

pluginId:version or pluginId:version@channel

plugins(notations)

Adds dependencies on plugins for IntelliJ Platform using a string notation:

pluginId:version or pluginId:version@channel

localPlugin(localPath)

Adds a dependency on a local IntelliJ Platform plugin. Accepts path or a dependency on another module.

The plugin(id, version, group) helpers accepts group as a third parameter, set by default to the common JetBrains Marketplace plugin artifacts group: com.jetbrains.plugins.

The group parameter can also describe the release channel by prefixing the value with @ character, like @eap or @nightly. The channel value is used to prepend the JetBrains Marketplace group and build nightly.com.jetbrains.plugins.

If defined explicitly, can be used along with any custom plugin repository, like: org.acme.plugins.

See also:

Testing

To implement tests for IntelliJ Platform plugin, it is necessary to explicitly add a dependency on the test-framework library containing the necessary test base classes. In most cases, the TestFrameworkType.Platform variant will be used:

import org.jetbrains.intellij.platform.gradle.TestFrameworkType dependencies { intellijPlatform { testFramework(TestFrameworkType.Platform) } testImplementation("junit:junit:4.13.2") }

The provided testFramework(type, version) helper method makes it possible to add the base artifact to the test classpath or its variants, such as Java, Go, ReSharper, etc.

Function

Description

testFramework(type, version)

Adds a dependency on Test Framework or its variant using TestFrameworkType type.

There are two known issues related to Platform and JUnit5 Test Frameworks:

See also:

Tools

Function

Description

pluginVerifier(version)

Adds a dependency on IntelliJ Plugin Verifier.

zipSigner(version)

Adds a dependency on Marketplace ZIP Signer.

bundledLibrary(path)

SEE NOTE BELOW

Adds a dependency on a bundled library JAR file of the current IntelliJ Platform, like lib/annotations.jar.

platformDependency(coordinates, version)

Adds a dependency on a custom IntelliJ Platform dependency available in the IntelliJ Maven Repositories.

testPlatformDependency(coordinates, version)

Adds a test dependency on a custom IntelliJ Platform dependency available in the IntelliJ Maven Repositories.

See also:

Java Runtime

Using the jetbrainsRuntime() or jetbrainsRuntimeExplicit() dependency helpers, it is possible to load a custom version of JetBrains Runtime. However, it is recommended to rely on the runtime bundled within the IntelliJ Platform dependency, if present.

Function

Description

jetbrainsRuntime()

Adds a dependency on JetBrains Runtime in version obtained with the current IntelliJ Platform if resolved from IntelliJ Maven Repository.

jetbrainsRuntime(version, variant, architecture)

Adds a dependency on JetBrains Runtime.

jetbrainsRuntimeLocal(path)

Adds a dependency on a local JetBrains Runtime instance.

jetbrainsRuntimeExplicit(explicitVersion)

Adds a dependency on JetBrains Runtime in explicit version.

See JetBrains Runtime (JBR) for more details.

Code Instrumentation

The code instrumentation process handled with the instrumentCode task, requires extra dependencies to work and properly adjust the Java bytecode. There's the instrumentationTools() dependencies helper introduced to apply all required dependencies using default configuration, however, it is possible to add and configure them separately.

Adds a Java Compiler dependency for code instrumentation. The version is determined by the IntelliJ Platform build number. If the exact version is unavailable, the closest one is used, found by scanning all releases.

Function

Description

instrumentationTools()

A helper function to apply all required dependencies: javaCompiler()

javaCompiler()

javaCompiler(version)

Adds a dependency on Java Compiler.

Last modified: 26 July 2024