IDE support for custom Gradle tasks in IntelliJ IDEA

Hi everyone,

I’m trying to create custom Gradle tasks in buildSrc. They compile great and work as expected when ran from the commandline.

The problem is that IntelliJ doesn’t recognize that Gradle automatically adds the following to the buildSrc project:

apply plugin: 'groovy'
  dependencies {
    compile gradleApi()
    groovy localGroovy()

For that reason, all API related classes (DefaultTask, TaskAction, etc) aren’t found and are marked red. Naturally there isn’t any code completion either…

Has anyone fixed it someone? Is there a way to add those dependencies manually?

Thanks in advance!