IntelliJ gradle plugin intellij.plugins problem
I'm using the IntelliJ gradle plugin version 0.4.16 with the Kotlin DSL in Gradle Wrapper 6.2.1 on the latest IntelliJ Ultimate 2020.1 EAP.
My build.gradle.kts contains:
intellij {
setPlugins(arrayOf("java"))
}
Which produces the following error:
Cannot find builtin plugin [java] for IDE: /Users/ross.goldberg/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/LATEST-EAP-SNAPSHOT/4ad1f820ccff90caffffdc882e06ce39c67dbaa/ideaIC-LATEST-EAP-SNAPSHOT
But that directory contains plugins/java, which the following web page seems to indicate should work when "java" is used as the plugin name.
https://github.com/JetBrains/gradle-intellij-plugin/
How can I fix this?
Using "com.intellij.java" or "com.intellij.modules.java" instead of "java" also fails.
Please sign in to leave a comment.
Changing from setPlugins(arrayOf("java")) to setPlugins("java") fixed it.
Is this a bug?
The corresponding Groovy property in IntelliJPluginExtension is:
Object[] plugins = []
It seems like setPlugins(arrayOf("java")) added an array as the element of the plugins array, rather than replacing the array.
There's no indication that setPlugins() is a vararg method.
What does this? Is this done by Groovy, Kotlin, Gradle, IntelliJ plugin, or something else? It's completely confusing, and really should be changed.
Could plugins be changed to a String[]? Maybe that would avoid the confusion…
arrayOf() is Kotlin stdlib function returning Array
You can find a number of sample build scripts on the bottom of https://github.com/JetBrains/gradle-intellij-plugin/ page, e.g.
https://github.com/acejump/AceJump/blob/master/build.gradle.kts
The syntax for using >1 plugin can be seen here
https://github.com/OpenASR/idear/blob/master/build.gradle.kts