org.eclipse.aether.repository.MirrorSelector Java Examples

The following examples show how to use org.eclipse.aether.repository.MirrorSelector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RepositoryPreferences.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * if the repository has a mirror, then create a repositoryinfo object for it..
 */

private RepositoryInfo getMirrorInfo(RepositoryInfo info, MirrorSelector selector, Settings settings) {
    RemoteRepository original = new RemoteRepository.Builder(info.getId(), /* XXX do we even support any other layout?*/"default", info.getRepositoryUrl()).build();
    RemoteRepository mirror = selector.getMirror(original);
    if (mirror != null) {
        try {
            String name = mirror.getId();
            //#213078 need to lookup name for mirror
            for (Mirror m : settings.getMirrors()) {
                if (m.getId() != null && m.getId().equals(mirror.getId())) {
                    name = m.getName();
                    break;
                }
            }
            RepositoryInfo toret = new RepositoryInfo(mirror.getId(), name, null, mirror.getUrl());
            toret.setMirrorStrategy(RepositoryInfo.MirrorStrategy.NONE);
            return toret;
        } catch (URISyntaxException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    return null;
}
 
Example #2
Source File: MavenSettings.java    From spring-init with Apache License 2.0 5 votes vote down vote up
private MirrorSelector createMirrorSelector(Settings settings) {
	DefaultMirrorSelector selector = new DefaultMirrorSelector();
	for (Mirror mirror : settings.getMirrors()) {
		selector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false,
				mirror.getMirrorOf(), mirror.getMirrorOfLayouts());
	}
	return selector;
}
 
Example #3
Source File: MavenArtifactResolvingHelperTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
public MavenArtifactResolvingHelperTest() {
    sessionMock = Mockito.mock(RepositorySystemSession.class);
    MirrorSelector mirrorSelectorMock = Mockito.mock(MirrorSelector.class);
    Mockito.when(sessionMock.getMirrorSelector()).thenReturn(mirrorSelectorMock);
    ProxySelector proxySelectorMock = Mockito.mock(ProxySelector.class);
    Mockito.when(sessionMock.getProxySelector()).thenReturn(proxySelectorMock);
    localRepositoryManager = Mockito.mock(LocalRepositoryManager.class);
    Mockito.when(sessionMock.getLocalRepositoryManager()).thenReturn(localRepositoryManager);
    resolver = Mockito.mock(ArtifactResolver.class);
    system = Mockito.mock(RepositorySystem.class);

}
 
Example #4
Source File: MavenSettings.java    From spring-cloud-function with Apache License 2.0 5 votes vote down vote up
private MirrorSelector createMirrorSelector(Settings settings) {
	DefaultMirrorSelector selector = new DefaultMirrorSelector();
	for (Mirror mirror : settings.getMirrors()) {
		selector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false,
				mirror.getMirrorOf(), mirror.getMirrorOfLayouts());
	}
	return selector;
}
 
Example #5
Source File: MavenSettings.java    From spring-init with Apache License 2.0 4 votes vote down vote up
public MirrorSelector getMirrorSelector() {
	return this.mirrorSelector;
}
 
Example #6
Source File: RepositorySystemSessionWrapper.java    From wildfly-swarm with Apache License 2.0 4 votes vote down vote up
@Override
public MirrorSelector getMirrorSelector() {
    return delegate.getMirrorSelector();
}
 
Example #7
Source File: RepositorySystemSessionWrapper.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@Override
public MirrorSelector getMirrorSelector() {
    return delegate.getMirrorSelector();
}
 
Example #8
Source File: MavenSettings.java    From spring-cloud-function with Apache License 2.0 4 votes vote down vote up
public MirrorSelector getMirrorSelector() {
	return this.mirrorSelector;
}
 
Example #9
Source File: LazyAuthenticationSelector.java    From furnace with Eclipse Public License 1.0 4 votes vote down vote up
LazyAuthenticationSelector(MirrorSelector mirrorSelector)
{
   this.mirrorSelector = mirrorSelector;
   this.defaultAuthSelector = new DefaultAuthenticationSelector();
}