Collection<JpsTypedLibrary<JpsSimpleElement<JpsMavenRepositoryLibraryDescriptor>>> (Collection<? extends JpsModule> modules) { final Collection<JpsTypedLibrary<JpsSimpleElement<JpsMavenRepositoryLibraryDescriptor>>> result = new SmartHashSet<>(); for (JpsModule module : modules) { for (JpsDependencyElement dep : module.getDependenciesList().getDependencies()) { if (dep instanceof JpsLibraryDependency) { final JpsLibrary _lib = ((JpsLibraryDependency)dep).getLibrary(); final JpsTypedLibrary<JpsSimpleElement<JpsMavenRepositoryLibraryDescriptor>> lib = _lib != null ? _lib.asTyped(JpsRepositoryLibraryType.INSTANCE) : null; if (lib != null) { result.add(lib); } } } } return result; }