How to get the configuration from Gradle plugin in IntelliJ plugin


I am creating an IntelliJ plugin.
I'm looking for a way to get the settings of the Gradle plugin from build.gradle.
For example


plugins {
id "org.jetbrains.kotlin.plugin.allopen" version "1.4.21"
allOpen {


class MyPlugin {
val annotationName = <Get it from Gradle> // ""


I figured I could use findGradleProjectStructure() to get it, but I couldn't find any data for the plugin.


Hi Ischa, sorry for long response, Christmas and NY holidays, you know.

Unfortunately, there was no way to work with Gradle DSL before 2021.1 in idea, however this support was in Android Studio

In 2021.1 gradle DSL moved from AS to core, however this API is still experimental and can be changed in future versions.

You can wait until 2021.1 goes into EAP (or grab a community sources, if you don't want to wait)  See intellij.gradle.dsl package and

But, you need to wait for release of next versions and use some experimental API, which could be incompatible changed in next releases.


For previous (and current) versions of IDEA, unfortunately I don't see another way than to parse gradle script as Groovy script. See intellij.groovy.psi

You can start investigating, say, from org.jetbrains.plugins.gradle.integrations.maven.codeInsight.completion.MavenDependenciesGradleCompletionContributor to get some examples how to work with groovy PSI.

However, I'm afraid in case of groovy PSI you have to process all variants like variables

def name=""

or variables in properties, etc. by your own.