Is there an option to declare <entryPoints> in Gradle Shadow like Maven Shade?

I am new. I hope I am asking the right question.

I am quoting from Maven Shade:

By default, all of the target module’s classes are kept and used as entry points for JAR minimization. By explicitly limiting the set of entry points, you can further minimize the set of classes kept in the shaded JAR. This affects both classes in the module itself and dependency classes.

I have a project structure like so:
→ src
-----> main
---------> groovy
-------------> com.example.testgroovy
-----------------> HelloWorld.groovy
-----------------> HelloGradle.groovy

When I use HelloWorld as entry point to package a jar, I don’t want to package HelloGradle, and vice versa. I can achieve this with in Maven Shade. How can I do this in Gradle Shadow?

I can, of course, use multi subprojects to separate unused classes into different subprojects, but these classes are usually just one file. So, I don’t see a need to separate them into different subprojects.

As you found already Is it possible to specify the entry points for minimize configuration? · Issue #885 · johnrengelman/shadow · GitHub, probably not

Yes, it is not, I don’t understand that the commit from the old request actually contains the “entry point” capability but it is not available when Shadow author said it was implemented.

Anyway, I try my best to understand the commit and come out with a working POC snippet to do the exactly that.

Refer to the linked GitHub issue if anyone is interested.

1 Like