List of usage examples for org.apache.maven.repository.legacy LegacyRepositorySystem createDefaultRemoteRepository
public ArtifactRepository createDefaultRemoteRepository() throws InvalidRepositoryException
From source file:net.oneandone.maven.embedded.Maven.java
License:Apache License
private static List<ArtifactRepository> repositoriesLegacy(LegacyRepositorySystem legacy, Settings settings) throws InvalidRepositoryException { boolean central; List<ArtifactRepository> result; List<String> actives; ArtifactRepository artifactRepository; central = false;//from w w w. j a v a 2 s. c o m result = new ArrayList<>(); actives = settings.getActiveProfiles(); for (Profile profile : settings.getProfiles()) { if (actives.contains(profile.getId()) || profile.getActivation().isActiveByDefault()) { for (org.apache.maven.model.Repository repository : SettingsUtils .convertFromSettingsProfile(profile).getRepositories()) { artifactRepository = legacy.buildArtifactRepository(repository); if ("central".equals(artifactRepository.getId())) { central = true; } result.add(artifactRepository); } } } if (!central) { /* Maven defines the default central repository in its master parent - and not in the default settings, which I'd prefer. As a consequent, central is not always defined when loading the settings. I first added central to repositories only, because legacy repositories are used to load poms which ultimatly load the master parent with it's repository definition. However, the parent might have to be loaded from central, so repositories also need a central definition. */ result.add(legacy.createDefaultRemoteRepository()); } return result; }