Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Minimizing a JAR #186

Closed
macalinao opened this issue Nov 13, 2015 · 4 comments
Closed

Minimizing a JAR #186

macalinao opened this issue Nov 13, 2015 · 4 comments

Comments

@macalinao
Copy link

The Maven shade plugin allows minimizing a JAR; that is, removing classes that are not used by the project. Is there a way you can implement that for this project?

@eed3si9n
Copy link
Member

Not 100% sure but I'm guessing that's what ShadeRule.keep("x.**").inAll does.
See also

@LannyRipple
Copy link

For anyone finding this ticket this might help.

Create a fat jar and your code jar. Use "java -jar jarjar.jar find class code.jar fat.jar" to list dependencies. You can use this output to create "keep" rules and process the fat jar (again with jarjar) to get your minimized jar.

@eed3si9n
Copy link
Member

eed3si9n commented Dec 9, 2015

sbt-assembly has jarjar instegration for keep. The find class thing looks interesting too.

@johnduffell
Copy link

johnduffell commented Aug 4, 2018

LannyRipple is right, you have to create a fat jar and then run jarjar's keep on that afterwards as sbt-assembly produces a broken fat jar if you try to use keep through the integration. in most cases it will omit all classes from the dependency jars. See my comment on #265 (comment)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants