private void removeProjectRepositoriesThatAreInSettings( final Collection<RemoteRepository> projectRepositories, final Collection<RemoteRepository> settingsRepositories) { final Collection<RemoteRepository> projectRepositoriesToRemove = new HashSet<RemoteRepository>(); final Iterator<RemoteRepository> projectRepositoryItr = projectRepositories.iterator(); while (projectRepositoryItr.hasNext()) { final RemoteRepository projectRepository = projectRepositoryItr.next(); for (RemoteRepository settingsRepository : settingsRepositories) { if (projectRepository.getId().equals(settingsRepository.getId())) { if (projectRepository.getUrl().equals(settingsRepository.getUrl())) { projectRepositoriesToRemove.add(projectRepository); } } } } projectRepositories.removeAll(projectRepositoriesToRemove); }
private MavenRepositoryMetadata makeRepositoryMetaData( final ArtifactRepository repository, final MavenRepositorySource source) { if (repository instanceof LocalRepository) { final LocalRepository localRepository = (LocalRepository) repository; return new MavenRepositoryMetadata( localRepository.getId(), MavenSettings.getSettings().getLocalRepository(), source); } else if (repository instanceof RemoteRepository) { final RemoteRepository remoteRepository = (RemoteRepository) repository; return new MavenRepositoryMetadata( remoteRepository.getId(), remoteRepository.getUrl(), source); } return null; }
private Mirror getMirror(RepositorySystemSession session, ArtifactRepository repository) { if (session != null) { org.eclipse.aether.repository.MirrorSelector selector = session.getMirrorSelector(); if (selector != null) { RemoteRepository repo = selector.getMirror(RepositoryUtils.toRepo(repository)); if (repo != null) { Mirror mirror = new Mirror(); mirror.setId(repo.getId()); mirror.setUrl(repo.getUrl()); mirror.setLayout(repo.getContentType()); return mirror; } } } return null; }