Programmatically add directory based dependency/library to module
The framework I'm writing a plugin for has a specific directory defined for "user" libraries, which can contain binary, source and javadoc JARs. I want my plugin to automatically add this directory as a directory based dependency/library to a module (or as a project library and then that library as a module dependency).
I've tried to find some example of this in the IDEA source code, but everything I'm finding it is heavily intertwined with GUI code and I can't find the point where you just say "create a dependency/library from this directory and add it to the module".
Can you provide some information on how to do such? Ultimately it will run from either AnAction, upon project open, or upon adding my Facet. So I have a handle on the module in all cases.
Please sign in to leave a comment.
I was able to determine how to do this. For the reference of others, here is the code I came up with.
Creating and Attaching a Directory Based Library
Creating and Attaching a JAR based Library
Hi Mark Vedder,
I am developing the same plugin where i am first downloading jar library to local project folder and then i am attaching that jar to modules.
I am able to see the jar file in project root folder and also able to see the jar in projectStructure ->modules->dependencies tab
But the packages/classes which are in jar are not reflecting to java code.
Pleasee help me in resolving this issue.
If i remove the jar from modules dependencies tab and again if i add the jar manually i am able to see the changes in java class.
Please help me in solving thins issue.
Thanks,
Sai Nikhil