Cannot add libraries to custom module from GUI
Hi,
I have a custom module which is really just a Java module that has a predefined project structure, an initial class, and some initial libraries. I can add libraries to the module programatically (mostly) fine, but when I go to the Module Settings -> Library and add a library to the module it does not get added.
My CustomModuleBuilder only overrides
getModuleType
getGroupNamesetupRootModel (and it calls the JavaModuleBuilder.setupRootModel at the end)A few interesting things I noticed as well that might be contributing1) Under Module Settings -> Modules my custom modules gives a blank screen, as opposed to the Java modules which give Sources/Paths/Dependencies.In my CustomModule.java I tied overriding the createWizardSteps/modify and returing StdModuleTypes.Java methods, but it did not change anything.2) In the module.iml it does not show the added libraries
3) If I go to Module Settings -> Libraries and try and remove the module it warns me that my custom module is using the library.
4) If I call ModuleRootManager.getInstance(source).orderEntries().forEachLibrary it does not find the libraries I attempted to add.
Is there usually an obvious cause for this? What paths are taken when adding a library via the GUI? I'm kind of at a loss where to investigate next.
Thanks,
Weston
Please sign in to leave a comment.
Hello,
if your module is really a Java module you shouldn't set a custom module type for it. IDEA checks module type in many places, and it indeed doesn't
show Sources/Paths/Dependencies tabs for non-java modules (because it makes no sense to specify e.g. output paths for ruby or python modules). You may
still use your own CustomModuleBuilder to create a initial structure and setup the project, but it should return StdModuleTypes.JAVA from
getModuleType method so the created module will be treated as a regular java module.
--
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"