IntelliJ IDEA里的dependency analyzer


你一定有这样的烦恼,那就是在一个大型的java项目里,类和模块都存在着复杂的依赖关系,这时你想抽取一部分或者说一个服务出来,同时呢你的要求有比较高一点,就是只抽取你需要的东西,别把整个项目都带上。
就好像,你只需要一根香蕉,不希望结果得到的是,一根香蕉,一只猴子拿着这根香蕉,猴子吊在一片森林的一颗树上,哦我的天哪,我需要的不是那么多,为什么给我那么多...

还好,IntelliJ Idea可以帮助你,它有一个小工具,叫做dependency analyzer,可以这样访问到:Analyze > Dependencies...

界面是这样的

屏幕截图 2021-04-27 111423.png

可以参考以下,摘录于:https://www.jetbrains.com/help/idea/dependencies-analysis.html

If you have a large Java project with several modules that uses multiple libraries, any operation that requires an essential structural change can be difficult. For example, if you decide to remove one of the libraries, extract an API or a new module, or modularize your application by switching to Java 9 Jigsaw modules, you need to analyze dependencies within your project in order to make sure that your change is not breaking anything.

IntelliJ IDEA has a tool that allows you to analyze dependencies between modules, packages, and classes in your application and prepare for structural changes - the dependency analyzer.


(完)