Intellij editor won't see the gradle api
Answered
Hi all.
I am trying to write a simple gradle plugin. I am creating gradle project from scratch, then, adding "java-gradle-plugin", that adds "java" plugin and "gradleApi()" to the compile configuration. But, completions and suggestion in intellij doesn't want to see gradle api.


What I am doing wrong?
IntelliJ IDEA 2017.1.2
Build #IU-171.4249.21
Please sign in to leave a comment.
This class belongs to gradle-core.
Sorry, but I don't understand.
Vast majority of guides about writing your own gradle plugin says, that I must add
plugins {id 'java-gradle-plugin'
}
or
And nothing about "gradle core"
Ok, I tried to add it manually:
dependencies {compile "org.gradle:gradle-core:3.5"
}
But no changes, intellij still can't resolve any symbol that I need to write simple gradle plugin.
May be I am missing something important. Help me, pls, just save my soul.
Not sure what's the problem, I've tried the sample from Gradle distribution and it works fine:
Please try File | Invalidate Caches | Invalidate and Restart.
Serge, seems I found what's the problem.
Preferences -> Editor -> File Types -> Ignore files and folders. In my case root "gradle" (not ".gradle") folder was added there (because I never used it, like a .git folder). And this caused broken suggestions and completions for the gradle api.
It's a bit strange behaviour, because I use gradle api via plugin (and not via buildSrc folder, which automatically adds gradle-api to the intellij module dependencis from that "gradle" folder) and it's not working
plugins {id 'java-gradle-plugin'
}
Is it a bug?
It's not a bug, libraries are loaded from .gradle directory (http://i.imgur.com/EQG9QAB.png). If it's ignored, IDE will not see or index any of the libraries. "gradle" directory also contains files that are needed for proper integration work. Please don't exclude these folders.