diff --git a/topics/tutorials/build_system/creating_plugin_project.md b/topics/tutorials/build_system/creating_plugin_project.md index a1f6233d7..d06ba8fa2 100644 --- a/topics/tutorials/build_system/creating_plugin_project.md +++ b/topics/tutorials/build_system/creating_plugin_project.md @@ -7,25 +7,12 @@ This documentation page describes a Gradle-based plugin project generated with the [New Project Wizard](https://www.jetbrains.com/help/idea/new-project-wizard.html) in IntelliJ IDEA, but the project generated with [](plugin_github_template.md) covers all the described files and directories. - - -> This page covers [](tools_gradle_intellij_plugin.md) only. -> -> See the [](tools_intellij_platform_gradle_plugin.md) reference. -> A dedicated page for it will be provided later. -> -{title="Gradle IntelliJ Plugin (1.x) Only"} - - - ## Creating a Plugin with New Project Wizard To enable the _IDE Plugin_ wizard, make sure _Gradle_ and _Plugin DevKit_ plugins are installed and enabled. - - Launch the New Project wizard via the File | New | Project... action and follow these steps: @@ -95,7 +82,7 @@ end title @enduml ``` -* The default IntelliJ Platform build.gradle.kts file (see next paragraph). +* The default IntelliJ Platform build.gradle.kts file (see [below](#build-gradle-kts)). * 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. @@ -104,7 +91,85 @@ end title * The META-INF directory under the default `main` [source set](https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_project_layout) contains the [plugin configuration file](plugin_configuration_file.md) and [plugin logo](plugin_icon_file.md). * The _Run IDE with Plugin_ [run configuration](https://www.jetbrains.com/help/idea/run-debug-configuration.html). -The generated `my_plugin` project build.gradle.kts file: +#### `build.gradle.kts` Gradle Build File +{id="build-gradle-kts"} + +The generated `my_plugin` project build.gradle.kts file depends on the IDE version used to generate the project: +- 2025.1+: [](tools_intellij_platform_gradle_plugin.md) variant +- earlier IDE versions: [](tools_gradle_intellij_plugin.md) variant (deprecated) + + + + + +```kotlin +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.5") + 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 { + sourceCompatibility = "21" + targetCompatibility = "21" + } + withType { + kotlinOptions.jvmTarget = "21" + } +} +``` + +* Three Gradle plugins are explicitly declared: + * [Gradle Java](https://docs.gradle.org/current/userguide/java_plugin.html) plugin (`java`) + * [Kotlin Gradle](https://kotlinlang.org/docs/gradle-configure-project.html#apply-the-plugin) plugin (`org.jetbrains.kotlin.jvm`) + * [](tools_intellij_platform_gradle_plugin.md) (`org.jetbrains.intellij.platform`) +* The Group from the [New Project](#create-ide-plugin) wizard is the `project.group` value +* `repositories`: setup required repositories ([](tools_intellij_platform_gradle_plugin_repositories_extension.md)) +* `dependencies`: + * define target IDE type (`IC`) and version (`2024.2.5`) ([](tools_intellij_platform_gradle_plugin_dependencies_extension.md#target-versions)) + * add dependency on the platform testing framework ([](tools_intellij_platform_gradle_plugin_dependencies_extension.md#testing)) +* `pluginConfiguration`: [`since-build`](tools_intellij_platform_gradle_plugin_extension.md#intellijPlatform-pluginConfiguration-ideaVersion) and initial [change notes](tools_intellij_platform_gradle_plugin_extension.md#intellijPlatform-pluginConfiguration-changeNotes) +* `sourceCompatibility` enforces using a 21 JDK + + + + ```kotlin plugins { @@ -168,7 +233,9 @@ tasks { * The initial [`signPlugin`](tools_gradle_intellij_plugin.md#tasks-signplugin) and [`publishPlugin`](tools_gradle_intellij_plugin.md#tasks-publishplugin) tasks configuration. See the [](publishing_plugin.md#publishing-plugin-with-gradle) section for more information. -> Consider using the [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template) which additionally provides CI setup covered with GitHub Actions. + + + #### Plugin Gradle Properties and Plugin Configuration File Elements