This documentation page describes a Gradle-based plugin project generated with the New Project Wizard in IntelliJ IDEA, but the project generated with IntelliJ Platform Plugin Template covers all the described files and directories.
Creating a Plugin with New Project WizardTo enable the IDE Plugin wizard, make sure Gradle and Plugin DevKit plugins are installed and enabled.
Plugin DevKit plugin must be installed from JetBrains Marketplace (Plugin Homepage) as it is not bundled since version 2023.3.
Create IDE PluginLaunch the New Project wizard via the action and follow these steps:
Select the IDE Plugin 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.
Projects generated with IntelliJ IDEA 2023.1 or newer support both Kotlin and Java sources out of the box. The wizard automatically creates the $PLUGIN_DIR$/src/main/kotlin sources directory. To add Java sources, add the $PLUGIN_DIR$/src/main/java directory manually.
Provide the Group which is typically an inverted company domain (e.g. com.example.mycompany
). It is used for the Gradle property project.group
value in the project's Gradle build script.
Provide the Artifact which is the default name of the build project artifact (without the version). It is also used for the Gradle property rootProject.name
value in the project's settings.gradle.kts file. For this example, enter my_plugin
.
Select a JDK matching the required Java version. It will be the default JRE used to run Gradle, and the JDK used to compile the plugin sources.
Java version must be set depending on the target platform version.
Java 21
Java 17
Click the Create button to generate the project.
For the my_plugin
example created with the steps described above, the following directory content is created:
my_plugin .run Run IDE with Plugin.run.xml gradle wrapper gradle-wrapper.jar gradle-wrapper.properties src main kotlin resources META-INF plugin.xml pluginIcon.svg .gitignore build.gradle.kts gradle.properties gradlew gradlew.bat settings.gradle.kts
The default IntelliJ Platform build.gradle.kts file (see below).
The gradle.properties file, containing properties used by Gradle build script.
The settings.gradle.kts file, containing a definition of the rootProject.name
and required repositories.
The Gradle Wrapper files in the gradle directory. The gradle-wrapper.properties file specifies the version of Gradle to be used to build the plugin. If needed, the IDE downloads the version of Gradle specified in this file automatically.
The META-INF directory under the default main
source set contains the plugin configuration file and plugin logo.
The Run IDE with Plugin run configuration.
build.gradle.kts
Gradle Build File
The generated my_plugin
project build.gradle.kts file depends on the IDE version used to generate the project:
2025.1+: IntelliJ Platform Gradle Plugin (2.x) variant
earlier IDE versions: Gradle IntelliJ Plugin (1.x) variant (deprecated)
plugins { id("java") id("org.jetbrains.kotlin.jvm") version "1.9.25" id("org.jetbrains.intellij.platform") version "2.3.0" } group = "org.example" version = "1.0-SNAPSHOT" repositories { mavenCentral() intellijPlatform { defaultRepositories() } } // Configure Gradle IntelliJ Plugin // Read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html dependencies { intellijPlatform { create("IC", "2024.2.6") testFramework(org.jetbrains.intellij.platform.gradle.TestFrameworkType.Platform) // Add necessary plugin dependencies for compilation here, example: // bundledPlugin("com.intellij.java") } } intellijPlatform { pluginConfiguration { ideaVersion { sinceBuild = "242" } changeNotes = """ Initial version """.trimIndent() } } tasks { // Set the JVM compatibility versions withType<JavaCompile> { sourceCompatibility = "21" targetCompatibility = "21" } withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { kotlinOptions.jvmTarget = "21" } }
Three Gradle plugins are explicitly declared:
Gradle Java plugin (java
)
Kotlin Gradle plugin (org.jetbrains.kotlin.jvm
)
IntelliJ Platform Gradle Plugin (2.x) (org.jetbrains.intellij.platform
)
The Group from the New Project wizard is the project.group
value
repositories
: setup required repositories (Repositories Extension)
dependencies
:
define target IDE type (IC
) and version (2024.2.6
) (Target Versions)
add dependency on the platform testing framework (Testing)
pluginConfiguration
: since-build
and initial change notes
sourceCompatibility
enforces using a 21 JDK
plugins { id("java") id("org.jetbrains.kotlin.jvm") version "1.9.21" id("org.jetbrains.intellij") version "1.17.4" } group = "com.example" version = "1.0-SNAPSHOT" repositories { mavenCentral() } // Configure Gradle IntelliJ Plugin // Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html intellij { version.set("2022.2.5") type.set("IC") // Target IDE Platform plugins.set(listOf(/* Plugin Dependencies */)) } tasks { // Set the JVM compatibility versions withType<JavaCompile> { sourceCompatibility = "17" targetCompatibility = "17" } withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { kotlinOptions.jvmTarget = "17" } patchPluginXml { sinceBuild.set("222") untilBuild.set("232.*") } signPlugin { certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) privateKey.set(System.getenv("PRIVATE_KEY")) password.set(System.getenv("PRIVATE_KEY_PASSWORD")) } publishPlugin { token.set(System.getenv("PUBLISH_TOKEN")) } }
Three Gradle plugins are explicitly declared:
The Gradle Java plugin (java
).
The Kotlin Gradle plugin (org.jetbrains.kotlin.jvm
).
The Gradle IntelliJ Plugin (1.x) (org.jetbrains.intellij
).
The Group from the New Project wizard is the project.group
value.
The sourceCompatibility
line is injected to enforce using Java 17 JDK to compile Java sources.
The values of the intellij.version
and intellij.type
properties specify the version and type of the IntelliJ Platform to be used to build the plugin.
The empty placeholder list for plugin dependencies.
The values of the patchPluginXml.sinceBuild
and patchPluginXml.untilBuild
properties specifying the minimum and maximum versions of the IDE build the plugin is compatible with.
The initial signPlugin
and publishPlugin
tasks configuration. See the Publishing Plugin With Gradle section for more information.
The Gradle properties rootProject.name
and project.group
will not, in general, match the respective plugin configuration file plugin.xml elements <name>
and <id>
. There is no IntelliJ Platform-related reason they should as they serve different functions.
The <name>
element (used as the plugin's display name) is often the same as rootProject.name
, but it can be more explanatory.
The <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.
runIde
Gradle task
Gradle projects are run from the IDE's Gradle tool window.
Adding Code to the ProjectBefore running my_plugin
, some code can be added to provide basic functionality. See the Creating Actions tutorial for step-by-step instructions for adding a menu action.
The generated project contains the Run IDE with 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, click the Sync All Gradle Projects button on the toolbar at the top of the Gradle tool window. Then 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.
For more information about how to work with Gradle-based projects see the Working with Gradle in IntelliJ IDEA screencast and working with Gradle tasks in the IntelliJ IDEA help.
24 April 2025
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4