如何通过IntelliJ open api获取依赖项列表

时间:2016-06-16 07:38:31

标签: java plugins intellij-idea intellij-plugin openapi

我正在为IntelliJ IDE开发一个插件,我想显示属于当前项目的依赖项。 有没有办法通过IntelliJ open api获取依赖项列表?

1 个答案:

答案 0 :(得分:1)

对于项目中的每个模块,您可以使用ModuleRootManager来获取依赖项:

// get the modules on which it depends
ModuleRootManager.getInstance(module).getDependencies()

// get the libraries on which it depends
ModuleRootManager.getInstance(module).getModifiableModel().getModuleLibraryTable()