private MirrorSelector getMirrorSelector(Settings settings) { DefaultMirrorSelector selector = new DefaultMirrorSelector(); for (Mirror mirror : settings.getMirrors()) { selector.add( String.valueOf(mirror.getId()), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(), mirror.getMirrorOfLayouts()); } return selector; }
/** * Gets mirror selector * * @return the selector */ public MirrorSelector mirrorSelector() { DefaultMirrorSelector dms = new DefaultMirrorSelector(); // fill in mirrors for (Mirror mirror : settings.getMirrors()) { // Repository manager flag is set to false // Maven does not support specifying it in the settings.xml dms.add( mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(), mirror.getMirrorOfLayouts()); } return dms; }
private void injectMirror(ArtifactRepository repository, Mirror mirror) { if (mirror != null) { ArtifactRepository original = createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(), repository.getSnapshots(), repository.getReleases()); repository.setMirroredRepositories(Collections.singletonList(original)); repository.setId(mirror.getId()); repository.setUrl(mirror.getUrl()); if (StringUtils.isNotEmpty(mirror.getLayout())) { repository.setLayout(getLayout(mirror.getLayout())); } } }
private URI getMirror(TargetDefinition.Repository location, List<Mirror> mirrors) throws URISyntaxException { URI p2RepositoryLocation = location.getLocation(); String id = location.getId(); if (id == null) { id = p2RepositoryLocation.toString(); } ArtifactRepository repository = repositorySystem.createArtifactRepository( id, p2RepositoryLocation.toString(), p2layout, P2_REPOSITORY_POLICY, P2_REPOSITORY_POLICY); Mirror mirror = repositorySystem.getMirror(repository, mirrors); return mirror != null ? new URI(mirror.getUrl()) : p2RepositoryLocation; }
private MirrorSelector getMirrorSelector() { DefaultMirrorSelector selector = new DefaultMirrorSelector(); for (Mirror mirror : mirrors) { selector.add( mirror.getId(), mirror.getUrl(), mirror.getType(), false, mirror.getMirrorOf(), null); } Settings settings = getSettings(); for (org.apache.maven.settings.Mirror mirror : settings.getMirrors()) { selector.add( String.valueOf(mirror.getId()), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(), mirror.getMirrorOfLayouts()); } return selector; }