buildSrc groovy and auto import of gradleApi

plugins

(Thomas) #1

Hello, first I’m sorry if it has been asked before but I couldn’t find any info about this.
I’m trying to develop a custom gradle plugin (with custom gradle task).
Basically, I only have a standard gradle groovy project (I used gradle init --type groovy-library) and added a buildSrc with src/main/groovy.
I created a GreetingTask as follow :

class GreetingTask extends DefaultTask {
    @TaskAction
    def action() {
        println "hello"
    }
}

But what I don’t get, is that neither DefaultTask nor TaskAction can be imported by Intellij (2016.3.1). It is annoying because I might need more and will always need to research which import/package I will need. Is this intended ?

Thank you very much for your help !