includeEmptyDirs = true broken in war plugin

I am in process of migrating a Maven project to Gradle. I have some empty directories in src/main/resources that I would like to exclude when building a .war file. I thought it would be as simple as:

war {
     includeEmptyDirs = false
     ......... rest of configuration ........
}

However, I still see empty directories included. Any ideas?

This is because changes to the ‘war’ task CopySpec do not affect the ‘web-inf’ directory. If you want to exclude those folders you should apply that configuration to the ‘processResources’ task instead.

processResources {
    includeEmptyDirs = false
}

great tip, thanks…