Plugin Dependencies
A plugin may depend on API and classes from other plugins, either bundled or third-party.
This document describes the syntax for declaring plugin dependencies and optional plugin dependencies. For more information about dependencies on the IntelliJ Platform modules, see Plugin Compatibility with IntelliJ Platform Products.
Required Steps
To express a dependency on classes from other plugins or modules, perform the following three required steps detailed below on this page:
Locate Plugin ID
Project Setup
Declaration in plugin.xml
1. Locating Plugin ID and Preparing Sandbox
A compatible version must be chosen carefully according to the plugin's compatibility. For non-bundled plugins, it is not possible to specify the minimum/maximum version for the dependent plugin. (Issue)
JetBrains Marketplace
For plugins published on JetBrains Marketplace:
Open plugin's detail page
Scroll down to the bottom section Additional Information
Copy Plugin ID
Bundled and Other Plugins
When using Gradle IntelliJ Plugin, all bundled plugin IDs can be gathered using listBundledPlugins
task.
When using DevKit and for non-public plugins, locate the plugin's main JAR file containing META-INF/plugin.xml descriptor with <id>
tag (or <name>
if not specified). Bundled plugins are located in $PRODUCT_ROOT$/plugins/$PLUGIN_NAME$/lib/$PLUGIN_NAME$.jar.
IDs of Bundled Plugins
The following table lists some commonly used bundled plugins and their ID. See also IntelliJ Community Plugins Extension Point and Listener List and Modules Specific to Functionality.
Plugin Name | Plugin ID | Related Documentation |
---|---|---|
Copyright |
| |
CSS |
| |
Database Tools and SQL |
| |
IntelliLang |
| |
Java |
| |
JavaScript and TypeScript |
| |
Kotlin |
| |
Markdown |
| |
Maven |
| |
Spring |
| |
Spring Boot |
| |
YAML |
|
Preparing Sandbox
If the plugin is not bundled with the target IDE, run the (sandbox) IDE Development Instance of your target IDE and install the plugin there.
2. Project Setup
Depending on the chosen development workflow (Gradle or DevKit), one of the two following steps is necessary.
Add the dependency to the intellij.plugins
parameter in your build script:
Add the JARs of the plugin on which the project depends to the Classpath of the IntelliJ Platform SDK.
Adding a plugin dependency in DevKit-based plugin
Open the Project Structure dialog and go to section.
Select the SDK used in the project.
Click the + button in the Classpath tab.
Select the plugin JAR depending on whether it is bundled or non-bundled plugin:
For bundled plugins, the plugin JAR files are located in plugins/$PLUGIN_NAME$ or plugins/$PLUGIN_NAME$/lib under the main installation directory.
For non-bundled plugins, depending on the platform version, the plugin JAR files are located in:
3. Dependency Declaration in plugin.xml
Regardless of whether a plugin project uses Modules Available in All Products, or Modules Specific to Functionality, the correct module must be listed as a dependency in plugin.xml. If a project depends on another plugin, the dependency must be declared like a module. If only general IntelliJ Platform features (APIs) are used, then a default dependency on com.intellij.modules.platform
must be declared.
To display a list of available IntelliJ Platform modules, invoke the code completion feature for the <depends>
element contents while editing the plugin project's plugin.xml file.
In the plugin.xml, add a <depends>
tag with the dependency plugin's ID as its content. Continuing with the example from Project Setup above, the dependency declaration in plugin.xml would be:
Optional Plugin Dependencies
A plugin can also specify an optional plugin dependency. In this case, the plugin will load even if the plugin it depends on is not installed or enabled, but part of the plugin's functionality will not be available.
Declare additional optional="true"
and required config-file
attribute pointing to the optional plugin descriptor file:
Sample
The plugin adds additional highlighting for Java and Kotlin files. The main plugin.xml defines a required dependency on the Java plugin (plugin ID com.intellij.java
) and registers the corresponding com.intellij.annotator
extension. Additionally, it specifies an optional dependency on the Kotlin plugin (plugin ID org.jetbrains.kotlin
):
plugin.xml
The configuration file myPluginId-withKotlin.xml is located in the same directory as the main plugin.xml file. In that file, the annotator extension for Kotlin is defined:
myPluginId-withKotlin.xml