how to add dependency to current active project in intellij plugin programatically
Answered
Hi team, I am developing a new plugin where i want to download jars(jar is available at specific url), I want to download it to current active project.
How can i do this?
Thanks
Nikhi
Please sign in to leave a comment.
You can download file using i.e.
Hi Jakub Chrzanowski,
Thanks, But I want to clarify that the jars are nothing but external libraries like gson, Jsch, opencsv. So what will be the targetDir to store these jars on a current active project .
It depends on your project's configuration and flows, I'm not aware of your project type nor use case, unfortunately.
ModuleRootModificationUtil may help you with setting a module directory programmatically.
Thanks Jakub, It can be any project like maven or gradle or can be a new Platform plugin. So, I need irrespective of the project that download should happen to correct destination. If it is a maven project i can handle the code of adding dependency section to pom.xml. But I am not aware the code to where or how to download that dependency to the current active project
As above - I've provided you with the way for east downloading the jar file and the method to add libraries to the given module. You just to have to connect these pieces into a solution.
Working with the Maven or Gradle dependencies is more complex and requires from you digging deeper in the related code, which you may find in the intellij-community repository.
Thanks Jakub, I will check into it.