Exclude dependency from War and create zip file of exculded dependencies

I have a application which have lot of dependencies and I want to reduce war footprint. I want to exclude these dependencies and create a .zip file of dependencies and I also want to know where to place this zip file so that when deployed to tomcat it can be picked up properly.

I tried to use providedCompile providedRuntime but its not working

  • define a configuration for the dependencies to be excluded (“myExcludes”)
  • in the project’s dependencies define “providedCompile myExcludes”
  • in the war task say “exclude myExcludes”
  • define a task which creates the zip for the “myExludes”
  • tell Gradle the war task depends on the zip task