How to specify IntelliJ Exclude Directories using Gradle?

As shown in the Gradle Build Language Reference, you can configure the idea.module.excludeDirs property, which is of type List<File>. Apparently IDEA doesn’t support including subdirectories of excluded directories, so you’ll have to exclude all siblings of build/generated-sources. For example:

idea {
    module {
        excludeDirs = [file(".gradle")]
        ["classes", "docs", "dependency-cache", "libs", "reports", "resources", "test-results", "tmp"].each {
            excludeDirs << file("$buildDir/$it")
        }
    }
}

If supported by the Protocol Buffer plugin, it may be easier to put the generated sources into a place outside build, and make that place known to the clean task (e.g. clean.delete "generated-sources").

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)