Excluding specific file collection from source set in Gradle

In my joint Scala+Java project I juggle source sets a lot. As a result I have application resources (from src/main/resources) included twice in the final WAR file. A quick look at the war input file collection gives an insight into the cause:

war.doFirst {
    classpath.each { f -> println f.name }
}

Outputs:

main
main
scala-library-2.10.2.jar
log4j-api-2.0-beta9.jar
...

Close look at the first two entries exposed that the first "main" file set contains all the final .class file and the resources, while the second "main" file set contains only resources. If I had that situation in Maven, I would've spent countless hours debugging plugins to sort out this kind of issue. But in Gradle I can patch the problem (since I do not expect anymore of those mixed projects and do not want to invest too much time in solving this once and for all):

war.doFirst {
    def cp = classpath.iterator()
    cp.next()                                       // Skip the first entry
    classpath = classpath.minus(files(cp.next()))   // Remove the second entry
}

That is a very project specific solution - I blindly remove second item from the WAR input source set. But it solves the problem.