Creating a Plugin Gradle Project
This documentation page describes a Gradle-based plugin project generated with the New Project Wizard, but the project generated with IntelliJ Platform Plugin Template covers all the described files and directories.
Creating a Plugin with New Project Wizard
Create IDE Plugin
Plugin DevKit plugin is bundled with IntelliJ IDEA until 2023.2.
Launch the New Project wizard via the action and provide the following information:
Select the IDE Plugin generator type from the list on the left.
Specify the project Name and Location.
Choose the Plugin option in the project Type.
Only in IntelliJ IDEA older than 2023.1:
Choose the Language the plugin will use for implementation. For this example select the Kotlin option. See also Kotlin for Plugin Developers for more information.
Provide the Group which is typically an inverted company domain (e.g.
com.example.mycompany). It is used for the Gradle property
project.groupvalue in the project's Gradle build script.
Provide the Artifact which is the default name of the build project artifact (without a version). It is also used for the Gradle property
rootProject.namevalue in the project's settings.gradle.kts file. For this example, enter
Select JDK 11. This JDK will be the default JRE used to run Gradle, and the JDK version used to compile the plugin sources.
After providing all the information, click the Create button to generate the project.
Components of a Wizard-Generated Gradle IntelliJ Platform Plugin
For the example
my_plugin created with the steps describes above, the IDE Plugin generator creates the following directory content:
The default IntelliJ Platform build.gradle.kts file (see next paragraph).
The gradle.properties file, containing properties used by Gradle build script.
The settings.gradle.kts file, containing a definition of the
rootProject.nameand required repositories.
The Gradle Wrapper files, and in particular the gradle-wrapper.properties file, which specifies the version of Gradle to be used to build the plugin. If needed, the IntelliJ IDEA Gradle plugin downloads the version of Gradle specified in this file.
The Run Plugin run configuration.
my_plugin project build.gradle.kts file:
Three Gradle plugins are explicitly declared:
The Group from the New Project wizard is the
sourceCompatibilityline is injected to enforce using Java 17 JDK to compile Java sources.
The empty placeholder list for plugin dependencies.
Plugin Gradle Properties and Plugin Configuration File Elements
The Gradle properties
project.group will not, in general, match the respective plugin configuration file plugin.xml elements
<id>. There is no IntelliJ Platform-related reason they should as they serve different functions.
<name> element (used as the plugin's display name) is often the same as
rootProject.name, but it can be more explanatory.
<id> value must be a unique identifier over all plugins, typically a concatenation of the specified Group and Artifact. Please note that it is impossible to change the
<id> of a published plugin without losing automatic updates for existing installations.
Running a Plugin With the runIde Gradle task
Gradle projects are run from the IDE's Gradle Tool window.
Adding Code to the Project
Executing the Plugin
The IDE Plugin generator automatically creates the Run Plugin run configuration that can be executed via the action or can be found in the Gradle tool window under the Run Configurations node.
To execute the Gradle
runIde task directly, open the Gradle tool window and search for the runIde task under the Tasks node. If it's not on the list, hit the re-import button in the toolbar at the top of the Gradle tool window. When the runIde task is visible, double-click it to execute.
To debug your plugin in a standalone IDE instance, please see How to Debug Your Own IntelliJ IDEA Instance blog post.