Reduce jar file size

后端 未结 3 846
天命终不由人
天命终不由人 2021-01-12 17:57

Is there any way to reduce jar file size?

I want a tool that reduces the unused dependencies.

I use maven for dependency management.

3条回答
  •  被撕碎了的回忆
    2021-01-12 18:21

    If you like to know the dependencies your project uses just check the maven-dependency-plugin which can be used to analyze the used/unused dependencies.

    Check your dependencies via:

    mvn dependency:analyze
    

    or take a look at the dep tree like this:

    mvn dependency:tree
    

    Or you can take a look into your ide (depending which one you use) for example with Eclipse (Indigo) and the m2e plugin you have a tab "Dependency Hierarchy" which shows the tree of dependencies incl. the transitive dependencies.

    In some situation you have to be careful about dependencies which are used by DI frameworks which can't be analyzed by maven-dependency-plugin or by ide plugins.

提交回复
热议问题