Search code examples
javagradleincludeshadowminimize

Gradle shadow: how to include some package


I have this dependency, I want to include this in the jar without minimizing it. enter image description here

But that will exclude some important classes. So I tried to use include dependency. enter image description here

But that will include all the classes.

How can I use the custom filter with code?

Or include special packages of dependency in the jar.


Solution

  • there are no default options to include partial set of classes from a jar (dependency).

    The 2 options you have are

    1. if this is a 'rarely' changing set of classes manually create a custom jar with the classes you need, save it local to project or in nexus and use it in the include

    2. if this is a 'often' changing set of classes create a task, before jar and after classes, to extract the classes you need in to the build/../classes folder