IntelliJ Platform Gradle Plugin – FAQ
Using the very same task documentation, configure runIde
task:
tasks {
runIde {
jvmArgumentProviders += CommandLineArgumentProvider {
listOf("-Dname=value")
}
}
}
tasks {
runIde {
jvmArgumentProviders.add({
["-Dname=value"]
} as CommandLineArgumentProvider)
}
}
The runIdeForUiTests
is no longer registered by default. Follow the task documentation for more details.
Due to the IJPL-157292 issue, the opentest4j
dependency is not resolved when using TestFrameworkType.Platform
or TestFrameworkType.JUnit5
.
This results in the NoClassDefFoundError
exception:
java.lang.NoClassDefFoundError: org/opentest4j/AssertionFailedError
To apply the workaround, add the missing org.opentest4j:opentest4j
test dependency to your Gradle build configuration:
dependencies {
// ...
testImplementation("org.opentest4j:opentest4j:1.3.0")
}
dependencies {
// ...
testImplementation 'org.opentest4j:opentest4j:1.3.0'
}
Due to the IJPL-159134 issue, the JUnit5 Test Framework refers to JUnit4 classes when running test.
This results in the NoClassDefFoundError
exceptions:
Caused by: java.lang.NoClassDefFoundError: junit/framework/TestCase
Caused by: java.lang.NoClassDefFoundError: org/junit/rules/TestRule
To apply the workaround, add the JUnit4 test runtime dependency to your Gradle build configuration:
dependencies {
// ...
testRuntimeOnly("junit:junit:4.13.2")
}
dependencies {
// ...
testRuntimeOnly 'junit:junit:4.13.2'
}
Using Gradle IntelliJ Plugin (1.x), specifying the directory name of the plugin was possible when adding a dependency on a bundled plugin for compatibility reasons. Now, using the actual plugin ID is required. For example, provide plugin ID com.intellij.java
instead of its directory name java
. A migration hint is provided for this and some other commonly used cases.
See Bundled and Other Plugins on how to get all bundled plugin IDs as well as a list of some commonly used ones.
See Enabling Auto-Reload for important caveats.
Disable auto-reload globally with intellijPlatform.autoReload
:
intellijPlatform {
autoReload = false
}
intellijPlatform {
autoReload = false
}
It is also possible to disable it for a specific runIde
-based task as follows:
tasks {
runIde {
autoReload = false
}
}
tasks {
runIde {
autoReload = false
}
}
Building the searchable options can be disabled using intellijPlatform.buildSearchableOptions
:
intellijPlatform {
buildSearchableOptions = false
}
intellijPlatform {
buildSearchableOptions = false
}
As a result of disabling building searchable options, the Settings that your plugin provides won't be searchable in the Settings dialog. Disabling of the task is suggested for plugins that are not intended to provide custom settings.
Gradle may fail with the following exception if the IntelliJ Platform Gradle Plugin is applied to the project multiple times with version specified more than once:
The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.
When applying the plugin in the settings.gradle.kts file, the version needs to be omitted when applying it in other build.gradle.kts files.
The most convenient way to see the logs of a running IDE is to add a tab to the Run tool window displaying the contents of idea.log file. In the Gradle runIde
run configuration, add the log file path according to sandbox location as described in View logs.
This exception is thrown when there's no setupDependencies
task present in the project scope.
See Migrating from Gradle IntelliJ Plugin for more details.
See the Bundling Plugin API Sources section for details.
To mute specific problems (for example, use of specific forbidden words in the plugin name), use the freeArgs
parameter to pass a comma-separated list of problem IDs to be muted.
See the list of available options.
intellijPlatform {
pluginVerification {
// ...
freeArgs = listOf(
"-mute",
"TemplateWordInPluginId,ForbiddenPluginIdPrefix"
)
}
}
intellijPlatform {
pluginVerification {
// ...
freeArgs = [
"-mute",
"TemplateWordInPluginId,ForbiddenPluginIdPrefix",
]
}
}
The Gradle IntelliJ Plugin, when targeting the IntelliJ SDK 2022.1+
, uses the PathClassLoader
class loader by the following system property:
-Djava.system.class.loader=com.intellij.util.lang.PathClassLoader
Because of that, JaCoCo – and other external tools that rely on classes available in the bootstrap class loader – fail to discover plugin classes.
In addition, if the code instrumentation is enabled (see intellij.instrumentCode
), it's required to switch to the compiled and instrumented output instead of default compiled classes.
The following changes to your Gradle configuration file:
tasks {
withType<Test> {
configure<JacocoTaskExtension> {
isIncludeNoLocationClasses = true
excludes = listOf("jdk.internal.*")
}
}
jacocoTestReport {
classDirectories.setFrom(instrumentCode)
}
jacocoTestCoverageVerification {
classDirectories.setFrom(instrumentCode)
}
}
test {
jacoco {
includeNoLocationClasses = true
excludes = ["jdk.internal.*"]
}
}
jacocoTestReport {
classDirectories.setFrom(instrumentCode)
}
jacocoTestCoverageVerification {
classDirectories.setFrom(instrumentCode)
}
Please upgrade to Kotlin 1.9.0. See the Incremental compilation section if using Kotlin 1.8.20.
To list the IntelliJ Platform releases matching your criteria (IntelliJ Platform type, release channels, or build range), use the printProductsReleases task as follows:
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
tasks {
printProductsReleases {
channels = listOf(ProductRelease.Channel.EAP)
types = listOf(IntelliJPlatformType.IntellijIdeaCommunity)
untilBuild = provider { null }
doLast {
val latestEap = productsReleases.get().max()
}
}
}
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
tasks {
printProductsReleases {
channels = [ProductRelease.Channel.EAP]
types = [IntelliJPlatformType.IntellijIdeaCommunity]
untilBuild = null
doLast {
def latestEap = productsReleases.get().max()
}
}
}
When running tests or IDE with your plugin loaded, it is necessary to use JetBrains Runtime (JBR). In the case, no JBR is found in the plugin configuration, there's the following warning logged by the verifyPluginProjectConfiguration
task:
The currently selected Java Runtime is not JetBrains Runtime (JBR).
This may lead to unexpected IDE behaviors.
Please use IntelliJ Platform binary release with bundled JBR
or define it explicitly with project dependencies or JVM Toolchain.
To correctly run your tests or a specific IDE:
use a binary IDE distribution with bundled JetBrains Runtime, i.e., by referring to a local IDE
local(localPath)
KotlinGroovyrepositories { mavenCentral() intellijPlatform { defaultRepositories() } } dependencies { intellijPlatform { local("/Users/hsz/Applications/IntelliJ IDEA Ultimate.app") } }
repositories { mavenCentral() intellijPlatform { defaultRepositories() } } dependencies { intellijPlatform { local '/Users/hsz/Applications/IntelliJ IDEA Ultimate.app' } }
add an explicit dependency on a JetBrains Runtime with
jetbrainsRuntime()
KotlinGroovyrepositories { mavenCentral() intellijPlatform { defaultRepositories() jetbrainsRuntime() } } dependencies { intellijPlatform { intellijIdeaCommunity("2024.3.4") jetbrainsRuntime("...") } }
repositories { mavenCentral() intellijPlatform { defaultRepositories() jetbrainsRuntime() } } dependencies { intellijPlatform { intellijIdeaCommunity '2024.3.4' jetbrainsRuntime '...' } }
specify the vendor when configuring the JVM Toolchain along with Foojay Toolchains Plugin:
KotlinGroovykotlin { jvmToolchain { languageVersion = JavaLanguageVersion.of(17) vendor = JvmVendorSpec.JETBRAINS } }
java { toolchain { languageVersion = JavaLanguageVersion.of(17) vendor = JvmVendorSpec.JETBRAINS } }
Add an explicit dependency on the bundled module:
dependencies {
intellijPlatform {
bundledModule("intellij.platform.vcs.impl")
}
}
note
Something missing?If a topic you are interested in is not covered in the above sections, let us know via the Was this page helpful? feedback form below or other channels.
Please be specific about the topics and reasons for adding them, and leave your email in case we need more details. Thanks for your feedback!