Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Can you use this to find non used classes as well? #5

Closed
Marcelovk opened this issue Nov 6, 2018 · 1 comment
Closed

Can you use this to find non used classes as well? #5

Marcelovk opened this issue Nov 6, 2018 · 1 comment

Comments

@Marcelovk
Copy link

Currently the generation of fat jars by spring is huge. A very simple hello world gives more than 10MB in classes. If we can use that to reduce the fatjar sizes it would be very useful

@avantgardnerio
Copy link
Owner

If there are no dynamic method invocations (reflection), you would use this for tree-shaking to reduce the size of your fat jars. You'd just have to change the HashSet operations from a union to an intersection or something.

I've heard that GraalVM does the same thing, so you might want to check that out.

Also, you may want to look into using OSGi to deploy a graph of jars by the maven coordinate. It's equivalent to a fat jar but doesn't increase build time. It can be as simple as using:

https://maven.apache.org/plugins/maven-dependency-plugin/resolve-mojo.html

to download all the jars. Then:

https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html

To build up the (very long) classpath string, then finally:

java -cp ${the-generated-classpath}

to run your app.

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

No branches or pull requests

2 participants