How to access dependencies of a java project using the IntelliJ SDK

Answered

I am currently developing a plugin and want to access the dependency information of a Java-Module (shown in the "Dependencies" tab in the Project Structure) using the IntelliJ SDK.
I looked for other plugins that achieve the same thing and in the one plugin I found they use a xml parser and parse the iml files. I don't think this is a good solution and would not be good for compatibility.
There has to be a better way because IntelliJ also somehow displays/uses the information. I already looked around the Community Edition Source Code for a few hours but could not find a solution.

1
2 comments

Of course I found the solution after asking here.

I continued looking around in the IDE source code and found that I can access the module dependencies this way:

ModuleRootManager.getInstance(module).getModifiableModel().getModuleLibraryTable().getLibraries()
1

how can I get module here?

0

Please sign in to leave a comment.