Gradle - 'flatten' default resource directory -


in project i've following directory setup:

  • src/main/resources/common
  • src/main/resources/local
  • src/main/resources/release

my goal override default resources elaboration , "flatten" directory tree in final archive.

at moment found ugly solution:

resources {   exclude 'release'   exclude 'common'   exclude 'local'   srcdir 'src/main/resources/common'   srcdir 'src/main/resources/local'   srcdir 'src/main/resources/release' } 

with solution think files in src/main/resources copied in final archive. there way exclude resources default directory?

is there better way solve problem?

a better approach override default locations:

sourcesets {     main {         resources {             srcdirs = [                 'src/main/resources/common',                  'src/main/resources/local',                 'src/main/resources/release'             ]         }     } } 

it's common idiom gradle apis offer property (such srcdirs) allows set collection (thereby overriding defaults), , named method (such srcdir) allows add collection (thereby adding defaults).

my goal [...] "flatten" directory tree in final archive.

not sure mean that.


Comments