Reputation: 7759
I have a setup where I have source file a/b/c.java
under a directory srcA
and a file with the same name a/b/c.java
under a directory srcB
. I want to exclude this file (or the full package a/b
) from directory srcB
and only use those from directory srcA
, but srcB
must be part of the source set because it contains other stuff.
A quick example of how I have things configured at the moment (which does not work):
sourceSets {
main {
java {
srcDir 'srcA'
srcDir 'srcB'
exclude 'srcB/a/b/**'
}
}
}
Upvotes: 0
Views: 78
Reputation: 123986
Try something like exclude { it.file.absolutePath.startsWith("$projectDir/srcB/a/b/") }
(use backslashes on Windows).
Upvotes: 1