Search code examples
javapluginsintellij-ideaintellij-pluginopenapi

How to get the list of dependencies via IntelliJ open api


I'm developing a plugin for IntelliJ IDE and I want to show the dependencies that belongs to the current project. Is there is a way to get the list of dependencies via IntelliJ open api?


Solution

  • For each module in your project, you can use ModuleRootManager to get the dependencies:

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