private void fillModuleDependencies() throws IvySettingsNotFoundException, IvySettingsFileReadException { final ModuleDescriptor descriptor = ivyManager.getModuleDescriptor(module); if (descriptor != null) { final DependencyDescriptor[] ivyDependencies = descriptor.getDependencies(); for (Module dependencyModule : IntellijUtils.getAllModulesWithIvyIdeaFacet(module.getProject())) { if (!module.equals(dependencyModule)) { for (DependencyDescriptor ivyDependency : ivyDependencies) { final ModuleId ivyDependencyId = ivyDependency.getDependencyId(); final ModuleId dependencyModuleId = getModuleId(dependencyModule); if (ivyDependencyId.equals(dependencyModuleId)) { LOGGER.info( "Recognized dependency " + ivyDependency + " as intellij module '" + dependencyModule.getName() + "' in this project!"); moduleDependencies.put(dependencyModuleId, dependencyModule); break; } } } } } }
@Nullable private ModuleId getModuleId(Module module) throws IvySettingsNotFoundException, IvySettingsFileReadException { if (!moduleDependencies.values().contains(module)) { final ModuleDescriptor ivyModuleDescriptor = ivyManager.getModuleDescriptor(module); if (ivyModuleDescriptor != null) { moduleDependencies.put(ivyModuleDescriptor.getModuleRevisionId().getModuleId(), module); } } for (ModuleId moduleId : moduleDependencies.keySet()) { if (module.equals(moduleDependencies.get(moduleId))) { return moduleId; } } return null; }