org.eclipse.aether.util.repository.DefaultMirrorSelector Java Examples
The following examples show how to use
org.eclipse.aether.util.repository.DefaultMirrorSelector.
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: MavenPluginRepository.java From BIMserver with GNU Affero General Public License v3.0 | 6 votes |
private DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system, File localRepoFile, Settings settings) { DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); if (!settings.getMirrors().isEmpty()) { DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector(); for (Mirror mirror : settings.getMirrors()) { mirrorSelector.add(mirror.getId(), mirror.getUrl(), "default", true, mirror.getMirrorOf(), "*"); } session.setMirrorSelector(mirrorSelector); } session.setProxySelector(proxySelector); LocalRepository localRepo = new LocalRepository(localRepoFile); session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo)); return session; }
Example #2
Source File: MavenSettings.java From spring-init with Apache License 2.0 | 5 votes |
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: GithubImporter.java From scava with Eclipse Public License 2.0 | 5 votes |
private static RepositorySystemSession newSession(RepositorySystem system) { DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); LocalRepository localRepo = new LocalRepository("target/local-repo"); session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo)); // set possible proxies and mirrors session.setProxySelector(new DefaultProxySelector().add(new Proxy(Proxy.TYPE_HTTP, "host", 3625), Arrays.asList("localhost", "127.0.0.1"))); session.setMirrorSelector( new DefaultMirrorSelector().add("my-mirror", "http://mirror", "default", false, "external:*", null)); return session; }
Example #4
Source File: MavenSettings.java From spring-cloud-function with Apache License 2.0 | 5 votes |
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: MavenContainer.java From furnace with Eclipse Public License 1.0 | 5 votes |
public DefaultRepositorySystemSession setupRepoSession(final RepositorySystem repoSystem, final Settings settings) { DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); session.setOffline(false); Proxy activeProxy = settings.getActiveProxy(); if (activeProxy != null) { DefaultProxySelector dps = new DefaultProxySelector(); dps.add(convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts()); session.setProxySelector(dps); } final DefaultMirrorSelector mirrorSelector = createMirrorSelector(settings); final LazyAuthenticationSelector authSelector = createAuthSelector(settings, mirrorSelector); session.setMirrorSelector(mirrorSelector); session.setAuthenticationSelector(authSelector); LocalRepository localRepo = new LocalRepository(new File(settings.getLocalRepository())); session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, localRepo)); session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE); session.setCache(new DefaultRepositoryCache()); boolean cacheNotFoundArtifacts = true; boolean cacheTransferErrors = true; session.setResolutionErrorPolicy(new SimpleResolutionErrorPolicy(cacheNotFoundArtifacts, cacheTransferErrors)); session.setWorkspaceReader(new ClasspathWorkspaceReader()); if (Boolean.getBoolean("org.apache.maven.log_transfer")) { session.setTransferListener(new JULMavenTransferListener()); } return session; }
Example #6
Source File: MavenContainer.java From furnace with Eclipse Public License 1.0 | 5 votes |
private DefaultMirrorSelector createMirrorSelector(Settings settings) { final DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector(); final List<Mirror> mirrors = settings.getMirrors(); if (mirrors != null) { for (Mirror mirror : mirrors) { mirrorSelector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(), mirror.getMirrorOfLayouts()); } } return mirrorSelector; }
Example #7
Source File: MavenContainer.java From furnace with Eclipse Public License 1.0 | 5 votes |
private LazyAuthenticationSelector createAuthSelector(final Settings settings, final DefaultMirrorSelector mirrorSelector) { LazyAuthenticationSelector authSelector = new LazyAuthenticationSelector(mirrorSelector); for (Server server : settings.getServers()) { authSelector.add( server.getId(), new AuthenticationBuilder().addUsername(server.getUsername()).addPassword(server.getPassword()) .addPrivateKey(server.getPrivateKey(), server.getPassphrase()).build()); } return authSelector; }
Example #8
Source File: LazyAuthenticationSelector.java From furnace with Eclipse Public License 1.0 | 4 votes |
LazyAuthenticationSelector(DefaultMirrorSelector mirrorSelector) { this.mirrorSelector = mirrorSelector; this.defaultAuthSelector = new DefaultAuthenticationSelector(); }