Using IntelliJ to open a build.gradle file, in the \"Import Project from Gradle\" window, the \"Excluded Roots\" are pre-populated with the .gradle
build.gradle
.gradle
Another solution. Works with Idea 13.
idea.module { excludeDirs -= file(buildDir) //1 buildDir.listFiles({d,f->f != 'generated-sources'} as FilenameFilter).each {excludeDirs += it}} //2
buildDir
excludeDirs
generating-source