How to exclude dependent jars from WEB-INF/lib for OSGi web bundle

for this case I would suggest to handle the exclusion of transitive dependencies on a more fine grained level by setting them dependency specific. You can set transitive flag to false for a specific dependency:

dependencies{
    compile ("org.acme:Proj:1.0"){
        transitive = false
    }
}

or instead of setting transitive to false exclude specific transitive deps by:

dependencies{
    compile ("org.acme:Proj:1.0"){
        exclude: group:'this', module:'that'
     }
}

again, the user guide contains a very detailed section about this stuff: http://gradle.org/docs/current/userguide/dependency_management.html

regards, René