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.3.1
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
Target Platforms
Default Target Platforms
See Custom Target Platforms for non-default targets.
Function | Description |
---|---|
| |
| |
| |
| |
| |
| Fleet Backend |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
Custom Target Platforms
Function | Description |
---|---|
| Adds a configurable dependency on the IntelliJ Platform. See Parametrize IntelliJ Platform Dependency. |
| Adds a configurable dependency on the IntelliJ Platform. See Parametrize IntelliJ Platform Dependency. |
| 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.
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.
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:
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
Make sure that required plugin repositories are defined to access non-bundled plugins.
See also:
Bundled Plugin
Use bundledPlugin(id)
or bundledPlugins(ids)
to add a dependency on bundled plugin. The list of bundled plugin IDs is available via printBundledPlugins
task.
Non-Bundled Plugin
Use plugin(notation)
or plugin(notations)
to add a dependency on a non-bundled plugin (for example, hosted on JetBrains Marketplace).
Parameter notation
uses the following format:
pluginId:version
orpluginId:version@channel
.
Alternatively, use plugin(id, version, group)
where the group
parameter can define a plugin release channel, like @eap
or a full Maven coordinates group. It is 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
.
Multi-Module Setup
When working on a multi-module project, use pluginModule(dependency)
to add a dependency on a plugin module to be bundled within the main plugin JAR. Requires passing an existing dependency, like pluginModule(implementation(project(":submodule")))
.
Local Plugin
Use localPlugin(localPath)
to add a dependency on a local IntelliJ Platform plugin. Accepts path or a dependency on another module.
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:
See TestFrameworkType
reference for other test-frameworks, for example, Plugin.Java
when testing Java-based functionality.
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 |
---|---|
| Adds a dependency on Test Framework or its variant using |
There are two known issues related to Platform
and JUnit5
Test Frameworks:
See also:
Tools
Function | Description |
---|---|
| Adds a dependency on IntelliJ Plugin Verifier. |
| Adds a dependency on Marketplace ZIP Signer. |
| SEE NOTE BELOW Adds a dependency on a bundled library JAR file of the current IntelliJ Platform, like lib/annotations.jar. |
| Adds a dependency on a custom IntelliJ Platform dependency available in the IntelliJ Maven Repositories. |
| 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 |
---|---|
| Adds a dependency on JetBrains Runtime in version obtained with the current IntelliJ Platform if resolved from IntelliJ Maven Repository. |
| Adds a dependency on JetBrains Runtime. |
| Adds a dependency on a local JetBrains Runtime instance. |
| 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 |
---|---|
| A helper function to apply all required dependencies: |
| Adds a dependency on Java Compiler. |