How to exclude certain WEB-INF/classes from war?

Hi all,
I bumped into the same issue described here:

I am trying to exclude some '**/WEB-INF/classes/com/xxxxxx/web/client/' files from my war bundle as shown below - and none of the tips out there worked as described in the above stackoverflow question. Any clue?

war {
    duplicatesStrategy 'exclude'
    classpath configurations.warLib
    classpath = classpath.filter{ file -> 
        (      !file.name.startsWith('javaee-api')
            && !file.name.startsWith('javax')
            && !file.name.startsWith('junit')
            && !file.name.startsWith('hamcrest')
            && !file.name.startsWith('gwt-slf4j')
        )
    }
    rootSpec.exclude('**/WEB-INF/classes/com/xxxxxx/web/client/')
}