Fetching content of resource folder of dependent JAR via IntelliJ plugin

I am working on a plugin, which can access the project dependency in classpath and provides handle to their resource folder.

For example -

My "SampleProject" has a dependent jar - "UserLookup" (fetched from m2 repository). This project contains data files in resources directory.

I need to provide a lookup feature, where users can find what files are present in resource folder of the dependent library "UserLookup" and also see their content.

 

I have tried using below, however, this does not give any access to project dependencies.

ProjectManager p = ProjectManager.getInstance();
Project[] projects = p.getOpenProjects();
FileEditorManager manager = FileEditorManager.getInstance(projects[0]);
0
1 comment

In order to get dependencies of you project you need to use com.intellij.openapi.roots.ModuleRootManager class. ModuleRootManager.getInstance(module).orderEntries().forEachLibrary() will process libraries from the module's dependencies.

0

Please sign in to leave a comment.