void (Project project, Collection<String> serviceUrls, Processor<? super Collection<RemoteRepositoryDescription>> resultProcessor) { ProgressManager.getInstance().run(new Task.Backgroundable(project, JavaPsiBundle.message("task.background.title.maven"), false) { @Override public void run(@NotNull ProgressIndicator indicator) { final Ref<List<RemoteRepositoryDescription>> result = Ref.create(Collections.emptyList()); try { final ArrayList<RemoteRepositoryDescription> repoList = new ArrayList<>(); for (String url : serviceUrls) { final List<RemoteRepositoryDescription> repositories; try { repositories = MavenRepositoryServicesManager.getRepositories(url); } catch (Exception ex) { LOG.warn("Accessing Service at: " + url, ex); continue; } repoList.addAll(repositories); } result.set(repoList); } catch (Exception e) { LOG.error(e); } finally { ApplicationManager.getApplication().invokeLater(() -> resultProcessor.process(result.get())); } } }); }