What's your opinion on the plugin build setup?

Hey, folks!
Behind the scenes, we’re working on making the plugin configuration more approachable and cleaner to you.
Over the last years, the Plugin Template was providing you with an opinionated solution and best practices. As for now, we’re reviewing that in order to prepare a setup friendly to the Plugin Module v2 — and having so many files hit us hard. Seems like the Gradle part is way too complicated.

Let’s take a look at the current Plugin Template setup with two submodules added on its top:

:two: settings.gradle.kts

rootProject.name = "IntelliJ Platform Plugin Template"

plugins {
    id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}

include("shared")
include("css")

:two: build.gradle.kts

import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
    id("java") // Java support
    alias(libs.plugins.kotlin) // Kotlin support
    alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
    alias(libs.plugins.changelog) // Gradle Changelog Plugin
    alias(libs.plugins.qodana) // Gradle Qodana Plugin
    alias(libs.plugins.kover) // Gradle Kover Plugin
}

group = providers.gradleProperty("pluginGroup").get()
version = providers.gradleProperty("pluginVersion").get()

// Set the JVM language level used to build the project.
kotlin {
    jvmToolchain(21)
}

// Configure project's dependencies
repositories {
    mavenCentral()

    // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
    intellijPlatform {
        defaultRepositories()
    }
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/version_catalogs.html
dependencies {
    testImplementation(libs.junit)
    testImplementation(libs.opentest4j)

    // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
    intellijPlatform {
        intellijIdea(providers.gradleProperty("platformVersion"))

        pluginModule(implementation(project(":shared")))
        pluginModule(implementation(project(":css")))

        // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
        bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })

        // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
        plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })

        // Module Dependencies. Uses `platformBundledModules` property from the gradle.properties file for bundled IntelliJ Platform modules.
        bundledModules(providers.gradleProperty("platformBundledModules").map { it.split(',') })

        testFramework(TestFrameworkType.Platform)
    }
}

// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
    pluginConfiguration {
        name = providers.gradleProperty("pluginName")
        version = providers.gradleProperty("pluginVersion")

        // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
        description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
            val start = "<!-- Plugin description -->"
            val end = "<!-- Plugin description end -->"

            with(it.lines()) {
                if (!containsAll(listOf(start, end))) {
                    throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
                }
                subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
            }
        }

        val changelog = project.changelog // local variable for configuration cache compatibility
        // Get the latest available change notes from the changelog file
        changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
            with(changelog) {
                renderItem(
                    (getOrNull(pluginVersion) ?: getUnreleased())
                        .withHeader(false)
                        .withEmptySections(false),
                    Changelog.OutputType.HTML,
                )
            }
        }

        ideaVersion {
            sinceBuild = providers.gradleProperty("pluginSinceBuild")
        }
    }

    signing {
        certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
        privateKey = providers.environmentVariable("PRIVATE_KEY")
        password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
    }

    publishing {
        token = providers.environmentVariable("PUBLISH_TOKEN")
        // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
        // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
        // https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#specifying-a-release-channel
        channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
    }

    pluginVerification {
        ides {
            recommended()
        }
    }
}

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
    groups.empty()
    repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
    versionPrefix = ""
}

// Configure Gradle Kover Plugin - read more: https://kotlin.github.io/kotlinx-kover/gradle-plugin/#configuration-details
kover {
    reports {
        total {
            xml {
                onCheck = true
            }
        }
    }
}

tasks {
    wrapper {
        gradleVersion = providers.gradleProperty("gradleVersion").get()
    }

    publishPlugin {
        dependsOn(patchChangelog)
    }
}

intellijPlatformTesting {
    runIde {
        register("runIdeForUiTests") {
            task {
                jvmArgumentProviders += CommandLineArgumentProvider {
                    listOf(
                        "-Drobot-server.port=8082",
                        "-Dide.mac.message.dialogs.as.sheets=false",
                        "-Djb.privacy.policy.text=<!--999.999-->",
                        "-Djb.consents.confirmation.enabled=false",
                    )
                }
            }

            plugins {
                robotServerPlugin()
            }
        }
    }
}

:three: shared/build.gradle.kts

plugins {
    alias(libs.plugins.kotlin)
    alias(libs.plugins.intelliJPlatformModule)
}

kotlin {
    jvmToolchain(21)
}

repositories {
    mavenCentral()

    intellijPlatform {
        defaultRepositories()
    }
}

dependencies {
    intellijPlatform {
        intellijIdea(providers.gradleProperty("platformVersion"))
    }
}

:four: css/build.gradle.kts

plugins {
    alias(libs.plugins.kotlin)
    alias(libs.plugins.intelliJPlatformModule)
}

kotlin {
    jvmToolchain(21)
}

repositories {
    mavenCentral()

    intellijPlatform {
        defaultRepositories()
    }
}

dependencies {
    implementation(project(":shared"))

    intellijPlatform {
        intellijIdea(providers.gradleProperty("platformVersion"))
        bundledPlugin("com.intellij.css")
    }
}

:five: gradle.properties

# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html

pluginGroup = org.jetbrains.plugins.template
pluginName = IntelliJ Platform Plugin Template
pluginRepositoryUrl = https://github.com/JetBrains/intellij-platform-plugin-template
# SemVer format -> https://semver.org
pluginVersion = 2.4.1

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 252

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformVersion = 2025.2.6.1

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
platformPlugins =
# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins =
# Example: platformBundledModules = intellij.spellchecker
platformBundledModules =

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 9.4.1

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false

# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache = true

# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = true

:six: gradle/libs.versions.toml

[versions]
# libraries
junit = "4.13.2"
opentest4j = "1.3.0"

# plugins
changelog = "2.5.0"
intelliJPlatform = "2.13.1"
kotlin = "2.3.20"
kover = "0.9.7"
qodana = "2025.3.2"

[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
opentest4j = { group = "org.opentest4j", name = "opentest4j", version.ref = "opentest4j" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
intelliJPlatformModule = { id = "org.jetbrains.intellij.platform.module", version.ref = "intelliJPlatform" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }

Pretty a lot, isn’t it? The above six files includes:

  • The main settings.gradle.kts defines two shared and css modules
  • build.gradle.kts defines repositories, dependencies on IntelliJ Platform, modules, libraries, initial IntelliJ Platform configuration, other plugins setup
  • shared/build.gradle.kts — just a dependency in IntelliJ Platform
  • css/build.gradle.kts — dependency on IntelliJ Platform and css plugin
  • some setup exposed as Gradle properties
  • Gradle Version Catalog

The usefullness of the last two is debatable. There’s also a lot of noise around IntelliJ Platform.

In the upcoming IntelliJ Platform Gradle Plugin 2.14.0, I have introduced several defaults, so we can skip a repeatable code, like Plugin Verifier’s recommended() helper or passing environment variables to signing/publishing properties.

That with dropping Version Catalog along with gradle.properties, and introducing submodules block together with dependencyResolutionManagement + pluginManagement inside settings.gradle.kts can result in a pretty slim setup:

:one: settings.gradle.kts

import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform

pluginManagement {
    plugins {
        id("org.jetbrains.kotlin.jvm") version "2.3.20"
    }
}

plugins {
    id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
    id("org.jetbrains.intellij.platform.settings") version "2.14.0"
}

dependencyResolutionManagement {
    repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS

    repositories {
        mavenCentral()

        intellijPlatform {
            defaultRepositories()
        }
    }
}

rootProject.name = "IntelliJ Platform Plugin Template"

include("shared")
include("css")
  • with pluginManagement , we’re defining globally the Kotlin Gradle Plugin version.
  • the plugins loads IntelliJ Platform Gradle Plugin Settings that allows to
  • define globally all the IntelliJ Platform repositories required for the project

:two: build.gradle.kts

import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
    id("org.jetbrains.kotlin.jvm")
    id("org.jetbrains.intellij.platform")
    id("org.jetbrains.changelog") version "2.5.0"
    id("org.jetbrains.qodana") version "2025.3.2"
    id("org.jetbrains.kotlinx.kover") version "0.9.7"
}

// Set the JVM language level used to build the project.
kotlin {
    jvmToolchain(21)
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/version_catalogs.html
dependencies {
    testImplementation("junit:junit:4.13.2")

    // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
    intellijPlatform {
        intellijIdea("2026.1")
        pluginModule(implementation(project(":shared")))
        pluginModule(implementation(project(":css")))

        testFramework(TestFrameworkType.Platform)
    }
}

subprojects {
    plugins.apply("org.jetbrains.kotlin.jvm")
    plugins.apply("org.jetbrains.intellij.platform.module")

    kotlin {
        jvmToolchain(21)
    }
    dependencies {
        intellijPlatform {
            intellijIdea("2025.3")
        }
    }
}

// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
    pluginConfiguration {
        // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
        description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
            val start = "<!-- Plugin description -->"
            val end = "<!-- Plugin description end -->"

            with(it.lines()) {
                if (!containsAll(listOf(start, end))) {
                    throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
                }
                subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
            }
        }

        val changelog = project.changelog // local variable for configuration cache compatibility
        // Get the latest available change notes from the changelog file
        changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
            with(changelog) {
                renderItem(
                    (getOrNull(pluginVersion) ?: getUnreleased())
                        .withHeader(false)
                        .withEmptySections(false),
                    Changelog.OutputType.HTML,
                )
            }
        }
    }
}

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
    groups.empty()
    repositoryUrl = "https://github.com/JetBrains/intellij-platform-plugin-template"
    versionPrefix = ""
}

// Configure Gradle Kover Plugin - read more: https://kotlin.github.io/kotlinx-kover/gradle-plugin/#configuration-details
kover {
    reports {
        total {
            xml {
                onCheck = true
            }
        }
    }
}

tasks {
    publishPlugin {
        dependsOn(patchChangelog)
    }
}

intellijPlatformTesting {
    runIde {
        register("runIdeForUiTests") {
            task {
                jvmArgumentProviders += CommandLineArgumentProvider {
                    listOf(
                        "-Drobot-server.port=8082",
                        "-Dide.mac.message.dialogs.as.sheets=false",
                        "-Djb.privacy.policy.text=<!--999.999-->",
                        "-Djb.consents.confirmation.enabled=false",
                    )
                }
            }

            plugins {
                robotServerPlugin()
            }
        }
    }
}
  • introduced submodule {} to configure Koltin JVM Toolchain, plugins, and dependency on the IntelliJ Platform for all submodules at once
  • the repositories {} block is now dropped
  • loaded Gradle plugins and dependencies no longer use Version Catalog and define versions directly
  • pluginConfiguration.name removed as we already define plugin name in plugin.xml
  • pluginConfiguration.version removed as it inherits from top-level version
  • ideaVersion.sinceBuild removed as we were setting it to major build number which is now default
  • ideaVersion.signing and ideaVersion.publishing removed as by default those properties read from mentioned env variables by default
  • pluginVerification.ides.recommended() is applied by default if nothing is specified
  • tasks.wrapper removed as it complicates flow when working with i.e. Dependabot or Renovate. Also, it’s pretty easy to use CLI for updating Gradle Wrapper.

:three: shared/build.gradle.kts

Build file is gone as everything is defined via root build file.

:four: shared/build.gradle.kts

dependencies {
    implementation(project(":shared"))
    intellijPlatform {
        bundledPlugin("com.intellij.css")
    }
}

Only additional setup is now declared here.

:five: gradle.properties

group = org.jetbrains.plugins.template
version = 2.4.1

kotlin.stdlib.default.dependency = false
org.gradle.configuration-cache = true
org.gradle.caching = true

This file defines only the project version and necessary Gradle flags.

:six: gradle/libs.versions.toml

Gradle Version Catalog is removed in favor of declaring everything in place. This can’t be used in settings.gradle.kts easily anyway.


If we strip the main build.gradle.kts file from Kover, Qodana, and Changelog Gradle plugins and provide the plugin description right in the plugin.xml file, we may end up with:

:two: build.gradle.kts

import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
    id("org.jetbrains.kotlin.jvm")
    id("org.jetbrains.intellij.platform")
}

kotlin {
    jvmToolchain(21)
}

dependencies {
    testImplementation("junit:junit:4.13.2")

    intellijPlatform {
        intellijIdea("2026.1")
        pluginModule(implementation(project(":shared")))
        pluginModule(implementation(project(":css")))

        testFramework(TestFrameworkType.Platform)
    }
}

subprojects {
    plugins.apply("org.jetbrains.kotlin.jvm")
    plugins.apply("org.jetbrains.intellij.platform.module")

    kotlin {
        jvmToolchain(21)
    }
    dependencies {
        intellijPlatform {
            intellijIdea("2025.3")
        }
    }
}

And here comes the question — what do you think of such a change? Should we keep gradle.properties and Gradle Version Catalog? What about Kover, Qodana, and Changelog? Should we keep reading README.md.

Please, join with your thoughts — let’s define together the first impressions for all newcomers joining the plugin development journey!
Thanks, Jakub

My personal opinion: to keep them all.

I found it useful (and familiar).

Gradle lists that as something to avoid, so not sure it would be good to use that in the template? General Gradle Best Practices

The only subprojects mention in that context is:

Don’t rely on blocks like allprojects {}, subprojects {}, or afterEvaluate {} that are highly dependent on project structure and file layout. They can be difficult to decipher and may depend on configuration details that are hard to understand completely without running the build.

I wouldn’t call that hard to decipher. The general subprojects usage is not discouraged. Or I missed something?

I guess I read it more strict as something to avoid since its in the best practices page.

I find convention plugins are better fits than subprojects, since not every gradle project in the Gradle build may be a IntelliJ module, I know I have one that is IDE agnostic so I instead rely on convention plugins to apply the common logic

My wishes would be:

1 and 3 are not related to the topic (3 is WIP, 1 I’ll prioritize).
2 — with the above idea, a lot is simplified. Details on what else would you expect would be really helpful.

A few more improvements results in the following

:two: build.gradle.kts

import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
    id("org.jetbrains.kotlin.jvm")
    id("org.jetbrains.intellij.platform")
}

dependencies {
    implementation(project(":shared"))
    implementation(project(":css"))
    testImplementation("junit:junit:4.13.2")

    intellijPlatform {
        intellijIdea("2026.1")
        testFramework(TestFrameworkType.Platform)
    }
}

subprojects {
    plugins.apply("org.jetbrains.kotlin.jvm")
    plugins.apply("org.jetbrains.intellij.platform.module")

    dependencies {
        intellijPlatform {
            intellijIdea("2026.1")
        }
    }
}
  • jvmToolchain can be now skipped as the Gradle plugin specifies now the convention for languageVersion and sets it to the Java version as listed in Build Number Ranges | IntelliJ Platform Plugin SDK
  • when defining a dependency on a submodule, you no longer need to pluginModule(implementation(project(":shared"))) but only implementation(project(":shared"))

Perhaps not related, but adding it in case it’s useful.

I’m converting a v1 plugin to a v2 module with split-plugins. It’s pretty complex to make it all work.

These things are difficult with the setup:

  • all *-backend, *-shared and *-frontend modules need the RPC setup and kotlinx-serialization setup. I’m currently using submodules {…} with a filter on the project name

  • dependencies with v2 are difficult. For example, to have one module use an external library, you either have to configure it as loading=embedded (which isn’t ideal and exposes more classes than necessary) or bundle the external JAR into the library. I’m using the Shadow Gradle plugin to setup dependency-only v2 modules, which then provide the bundled JAR as a module to other modules. Simplifying this would be very helpful, especially because it needs Shadow setup to make the shaded jar the subproject’s main output, because it’s used by pluginModule.

  • The v2 module names must be a.b.c.jar. My build setup uses directory names with dashes a-b-c, e.g. plugin-lang-backend which then needs setup to fix the JAR name. Perhaps the Gradle plugin could introduce a module name property and handle dashes?

  • The setup of the Gradle kotlinx-serialization and the Gradle RPC plugins depends on the platform version. Here’s settings.gradle.kts for a one-build-per-major-version setup:

    kotlin("plugin.serialization") version when (platformVersion) {
        253 -> "2.2.21"
        else -> "2.3.10"
    }
    
    id("rpc") version when (platformVersion) {
        253 -> "2.2.21-0.1"
        else -> "2.3.10-RC-0.1"
    }
    
  • The frontend modules needs Gradle setup for the kotlix-serialization dependencies. AFAIK they should match the platformn version, too. I’ll have to keep this in sync with the platform version libraries at Third Party Software and Licenses - JetBrains

1 Like