How to remove classes from a dependency after compile

I am new to gradle and trying to update an existing build file. The current script has bunch of compiles for the artifact jars in dependencies which get included into project war. However I need to remove few classes from one of the jar after compile before it gets included into war, how can I do this?

Appreciate your help.