Accessing the Libraries of a Project
How do I access the libraries of a Project? (more specifically, how can I programmatically add libraries to a Project?)
I am able to do this if I have a `Module` (get a `ModifiableModel` from it and add a libray to it) but my project doesn't have any modules, so this approach doesn't work, and I can't find any method on the `Project` or `RootProjectManager` object to get such a model.
Thanks!
请先登录再写评论。
you could try to add a global library:
https://github.com/JetBrains/intellij-community/blob/210e0ed138627926e10094bb9c76026319cec178/platform/lang-impl/src/com/intellij/util/ui/classpath/SimpleClasspathElementFactory.java#L66
I did not try it. No warranties
ProjectLibraryTable is what you need for this.