From ddb6e013aabbb0f07cde124012a1b54361bb84a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Mon, 7 Apr 2025 15:11:38 +0200 Subject: [PATCH] creating_plugin_project.md: cleanup --- .../build_system/creating_plugin_project.md | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/topics/tutorials/build_system/creating_plugin_project.md b/topics/tutorials/build_system/creating_plugin_project.md index 267b6ac74..a1f6233d7 100644 --- a/topics/tutorials/build_system/creating_plugin_project.md +++ b/topics/tutorials/build_system/creating_plugin_project.md @@ -4,7 +4,8 @@ Creating and running a Gradle-based IntelliJ Platform plugin project. -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), but the project generated with [](plugin_github_template.md) covers all the described files and directories. +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. @@ -19,14 +20,16 @@ This documentation page describes a Gradle-based plugin project generated with t ## 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 provide the following information: -1. Select the IDE Plugin generator type from the list on the left. +Launch the New Project wizard via the File | New | Project... action and follow these steps: +1. Select the IDE Plugin type from the list on the left. 2. Specify the project Name and Location. 3. Choose the Plugin option in the project Type. 4. _Only in IntelliJ IDEA older than 2023.1:_ @@ -36,28 +39,28 @@ Launch the New Project wizard via the File | New | P See also [Kotlin for Plugin Developers](using_kotlin.md) for more information. > Projects generated with IntelliJ IDEA 2023.1 or newer support both Kotlin and Java sources out of the box. - > The Project generator automatically creates \$PLUGIN_DIR\$/src/main/kotlin sources directory. - > To add Java sources, create the \$PLUGIN_DIR\$/src/main/java directory manually. + > 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. > {style="note" title="Using Kotlin and Java sources"} 5. 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. -6. Provide the Artifact which is the default name of the build project artifact (without a version). +6. 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`. -7. Select JDK 17. - This JDK will be the default JRE used to run Gradle, and the JDK version used to compile the plugin sources. +7. 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. -8. After providing all the information, click the Create button to generate the project. +8. 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: +For the `my_plugin` example created with the steps described above, the following directory content is created: ```plantuml @startuml @@ -95,10 +98,11 @@ end title * 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.name` and 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 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 Plugin_ [run configuration](https://www.jetbrains.com/help/idea/run-debug-configuration.html). +* 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](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: @@ -178,20 +182,20 @@ Please note that it is impossible to change the `` of a published plugin wit ## Running a Plugin With the `runIde` Gradle task -Gradle projects are run from the IDE's Gradle Tool window. +Gradle projects are run from the IDE's Gradle tool window. ### Adding Code to the Project -Before running [`my_plugin`](#components-of-a-wizard-generated-gradle-intellij-platform-plugin), some code can be added to provide simple functionality. +Before running [`my_plugin`](#components-of-a-wizard-generated-gradle-intellij-platform-plugin), some code can be added to provide basic functionality. See the [](creating_actions_tutorial.md) tutorial for step-by-step instructions for adding a menu action. ### Executing the Plugin -The _IDE Plugin_ generator automatically creates the _Run Plugin_ run configuration that can be executed via the Run | Run... action or can be found in the Gradle tool window under the Run Configurations node. +The generated project contains the _Run IDE with Plugin_ run configuration that can be executed via the Run | Run... 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](https://www.jetbrains.com/help/idea/jetgradle-tool-window.html#gradle_toolbar) at the top of the Gradle tool window. -When the runIde task is visible, double-click it to execute. +If it's not on the list, click the Sync All Gradle Projects button on the [toolbar](https://www.jetbrains.com/help/idea/jetgradle-tool-window.html#gradle_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](https://medium.com/agorapulse-stories/how-to-debug-your-own-intellij-idea-instance-7d7df185a48d) blog post.