How to copy jar in libs folder using Intellij plugin development APIs
I am developing intellij plugin, on click of menu option it should copy jar to libs folder of select project. kindly provide any link or code refrence how I can implement this.
Please sign in to leave a comment.
Hello,
You can obtain a file handle via regular java file api like below
Denis
So, why don't you copy that jar to the selected lib folder?
Denis
I want to do it through right clicking on project and select plugin option 'Add Jar'.
Because the required jar is provided through this plugin only.
The same thing I have implemented for eclipse plugin.
Sorry but it's hard to guess what did you do in eclipse plugin.
Could you be more specific in your questions because for now it looks like you ask to implement a plugin.
Denis
I want to give user this option using plugin for rapid development.
When user will right click on project and select this option then jar will be added on "selected_project\app\libs" this path
I hope now you understood my question.
What is 'user will right on project'? Do you mean project view or project settings or something else?
And yes, your question still lacks the details.
Denis
finally below code works.
PluginId runtimePluginId = PluginManager.getPluginByClassName("com.company.AnyClassInYourPlugin"); IdeaPluginDescriptor runtimePlugin = PluginManager.getPlugin(runtimePluginId); File yourJar = new File(runtimePlugin.getPath().getAbsolutePath(), "your-file.jar");the API allows you to retrieve a plugin descriptor for that plugin,which then allows you to get the absolute path to the plugin or any jar related to it.@Vibha, thanks for the above code. can you please post the code to paste the jar in lib of a project.