IntelliJ Platform Plugin SDK Help

JetBrains Runtime (JBR)

JetBrains Runtime (JBR) is a custom version of OpenJDK, specifically optimized for IntelliJ-based IDEs. It supports enhanced class redefinition (DCEVM), includes the Java Chromium Embedded Framework (JCEF), and improves aspects such as font rendering and keyboard support, thereby enhancing overall performance. IDEs built on the IntelliJ Platform rely on JBR for running. Hence, when developing plugins using the IntelliJ Platform Gradle Plugin, it's essential to have JBR provided.

For the best experience, it is recommended to rely on JBR bundled with the IntelliJ Platform used for development. If one is not available, i.e., when targeting IntelliJ Platform snapshot or nightly releases, there are other ways available for providing JetBrains Runtime in a required version or variant.

Bundled (Default)

IDE releases provided with JetBrains CDN (download.jetbrains.com) are OS-specific and contain JetBrains Runtime (JBR) already bundled within the archive. This is the recommended way for developing a plugin, as it comes in exactly the same version as JetBrains IDEs delivered to users.

To use this approach, no extra steps are required but declare the IntelliJ Platform, see: Target Platforms.

Obtained with IntelliJ Platform from Maven

If the IntelliJ Platform is resolved with the IntelliJ Maven Repository, it has no JetBrains Runtime (JBR) bundled. In such a case, it is necessary to provide it in the suitable version with the version read from the [intellijPlatform]/dependencies.txt file.

This can be easily achieved by using the jetbrainsRuntime() repository helper pointing to JetBrains Runtime GitHub Releases and dependency helper with no arguments provided:

repositories { mavenCentral() intellijPlatform { defaultRepositories() jetbrainsRuntime() // ... } } dependencies { intellijPlatform { intellijIdeaCommunity("2024.1.4") jetbrainsRuntime() // ... } }

Declared Explicitly

It is possible to explicitly specify JetBrains Runtime version, variant, or exact build with:

repositories { mavenCentral() intellijPlatform { defaultRepositories() jetbrainsRuntime() // ... } } dependencies { intellijPlatform { intellijIdeaCommunity("2024.1.4") jetbrainsRuntime(version, variant, architecture) // or jetbrainsRuntimeExplicit(explicitVersion) // ... } }

Provided version, variant, and architecture parameters along with the explicitVersion are used to resolve the JetBrains Runtime archives published on GitHub Releases page.

To correctly understand the pattern, refer to the archive names in format:

jbr_[prefix]-[jdk]-[os]-[arch]-b[build].tar.gz

e.g.:

jbr_jcef-21.0.3-osx-aarch64-b446.1.tar.gz

which can be split into the following parts:

  • prefix = jcef

  • jdk = 21.0.3

  • os = osx

  • arch = aarch64

  • build = 446.1

Note that the version parameter is actually a combination of JDK and build numbers in format [jdk]b[build].

To resolve the jbr_jcef-21.0.3-osx-aarch64-b446.1.tar.gz archive, you can use:

  • jetbrainsRuntime("21.0.3b446.1", "osx", "aarch64")

  • jetbrainsRuntime("21.0.3b446.1") (os and architecture are by default resolved with the current environment)

  • jetbrainsRuntimeExplicit("jbr_jcef-21.0.3-osx-aarch64-b446.1")

See the JetBrains Runtime releases page for the list of available releases.

Foojay Toolchains Plugin

Since Gradle 8.4, it is possible to specify JetBrains as a known JVM vendor and instruct Gradle to search for JetBrains Runtime within available toolchains (see Toolchains for JVM projects).

Along with the Foojay Toolchains Plugin, Gradle can resolve JetBrains Runtime from the remote repository if the suitable JVM is not present:

build.gradle.kts

kotlin { jvmToolchain { languageVersion = JavaLanguageVersion.of(17) vendor = JvmVendorSpec.JETBRAINS } }

settings.gradle.kts

plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "..." }

Please note that the latest available JetBrains Runtime release is always resolved, which may lead to unexpected behaviors.

Project SDK

When building or running a project directly from the IDE, it is possible to specify JetBrains Runtime in Project Settings as a Project SDK.

Provided JBR will be eventually resolved and passed to Gradle tasks for running. However, this setting is ignored when running a project directly from the command line or CI.

Last modified: 04 July 2024