What is the best way to take dependency library in Plugin

Answered

Dear all I am developing idea plugin based on Gradle workflow. 
Have compile time dependency from other libraries in my built.gradle. 
Want to take that jar file run time and get from there some property.

Is this the best way of doing that

 

File pluginFile = Objects.requireNonNull(PluginManager.getPlugin(PluginId.findId("com.metaring.platform-plugin-idea"))).getPath(); 
File pluginLibFile = new File(pluginFile.getAbsolutePath() + File.separator + "lib"); 
File[] platformIdeJarFiles = pluginLibFile.listFiles(file -> file.getName().contains("platform-ide-plugin")); 

Same question here

Thanks

4 comments
Comment actions Permalink

What exactly is "get from there some property"? If you want to access some resouce located in JAR file, you can use getClass().getResource() etc.

0
Comment actions Permalink

"get from there some property" -  I have json.file in xxx.jar which is in dependency of my plugin.

Beside of what I mentioned in above code, is there any possibility to take the file content through the Idea API ?

 

Regards

0
Comment actions Permalink

What do you expect the platform API to do for you?

0
Comment actions Permalink

For example providing all plugin dependency libs or ids of dependency libs (like you have in getDependentPluginIds() method).

As I mentioned I can shortly take the dependency jars folder where situated lib folder, under which have jars what I need:

PluginManager.getPlugin(PluginId.findId("com.metaring.platform-plugin-idea")).getPath())

Anyway, now using another functionality in my plugin and for now this part just for curiosity.

 

Thanks for your patience and time

0

Please sign in to leave a comment.