Search in sources :

Example 61 with RemoteRepository

use of org.eclipse.aether.repository.RemoteRepository in project storm by apache.

the class DependencyResolver method applyProxy.

private void applyProxy() {
    List<RemoteRepository> appliedRepositories = new ArrayList<>(remoteRepositories.size());
    for (RemoteRepository repository : remoteRepositories) {
        appliedRepositories.add(new RemoteRepository.Builder(repository).setProxy(proxy).build());
    }
    this.remoteRepositories = appliedRepositories;
}
Also used : ArrayList(java.util.ArrayList) RemoteRepository(org.eclipse.aether.repository.RemoteRepository)

Example 62 with RemoteRepository

use of org.eclipse.aether.repository.RemoteRepository in project pinpoint by naver.

the class DependencyResolver method newRepositories.

static List<RemoteRepository> newRepositories(String... urls) {
    List<RemoteRepository> repositories = new ArrayList<>(urls.length + 1);
    RemoteRepository mavenCentralRepository = newMavenCentralRepository();
    repositories.add(mavenCentralRepository);
    int localRepositoriesCount = 0;
    for (String url : urls) {
        RemoteRepository remoteRepository = new RemoteRepository.Builder("local" + localRepositoriesCount, "default", url).build();
        repositories.add(remoteRepository);
    }
    return repositories;
}
Also used : ArrayList(java.util.ArrayList) RemoteRepository(org.eclipse.aether.repository.RemoteRepository)

Example 63 with RemoteRepository

use of org.eclipse.aether.repository.RemoteRepository in project zeppelin by apache.

the class InterpreterSettingManager method loadFromFile.

/**
 * Load interpreter setting from interpreter.json
 */
private void loadFromFile() throws IOException {
    InterpreterInfoSaving infoSaving = configStorage.loadInterpreterSettings();
    if (infoSaving == null) {
        // setting from interpreterSettingTemplates
        for (InterpreterSetting interpreterSettingTemplate : interpreterSettingTemplates.values()) {
            InterpreterSetting interpreterSetting = new InterpreterSetting(interpreterSettingTemplate);
            initInterpreterSetting(interpreterSetting);
            if (shouldRegister(interpreterSetting.getGroup())) {
                addInterpreterSetting(interpreterSetting);
            }
        }
        return;
    }
    // TODO(zjffdu) still ugly (should move all to InterpreterInfoSaving)
    for (InterpreterSetting savedInterpreterSetting : infoSaving.interpreterSettings.values()) {
        if (!shouldRegister(savedInterpreterSetting.getGroup())) {
            continue;
        }
        savedInterpreterSetting.setProperties(InterpreterSetting.convertInterpreterProperties(savedInterpreterSetting.getProperties()));
        initInterpreterSetting(savedInterpreterSetting);
        InterpreterSetting interpreterSettingTemplate = interpreterSettingTemplates.get(savedInterpreterSetting.getGroup());
        // the user saved interpreter setting
        if (interpreterSettingTemplate != null) {
            savedInterpreterSetting.sortPropertiesByTemplate(interpreterSettingTemplate.getProperties());
            savedInterpreterSetting.fillPropertyDescription(interpreterSettingTemplate.getProperties());
            // merge InterpreterDir, InterpreterInfo & InterpreterRunner
            savedInterpreterSetting.setInterpreterDir(interpreterSettingTemplate.getInterpreterDir());
            savedInterpreterSetting.setInterpreterInfos(interpreterSettingTemplate.getInterpreterInfos());
            savedInterpreterSetting.setInterpreterRunner(interpreterSettingTemplate.getInterpreterRunner());
        } else {
            LOGGER.warn("No InterpreterSetting Template found for InterpreterSetting: {}," + " but it is found in interpreter.json, it would be skipped.", savedInterpreterSetting.getGroup());
            continue;
        }
        // remove it first
        for (InterpreterSetting setting : interpreterSettings.values()) {
            if (setting.getName().equals(savedInterpreterSetting.getName())) {
                removeInterpreterSetting(setting.getId());
            }
        }
        savedInterpreterSetting.postProcessing();
        LOGGER.info("Create interpreter setting {} from interpreter.json", savedInterpreterSetting.getName());
        addInterpreterSetting(savedInterpreterSetting);
    }
    for (InterpreterSetting interpreterSettingTemplate : interpreterSettingTemplates.values()) {
        InterpreterSetting interpreterSetting = new InterpreterSetting(interpreterSettingTemplate);
        initInterpreterSetting(interpreterSetting);
        // add newly detected interpreter if it doesn't exist in interpreter.json
        if (!interpreterSettings.containsKey(interpreterSetting.getId())) {
            LOGGER.info("Create interpreter setting: {} from interpreter setting template", interpreterSetting.getId());
            addInterpreterSetting(interpreterSetting);
        }
    }
    if (infoSaving.interpreterRepositories != null) {
        for (RemoteRepository repo : infoSaving.interpreterRepositories) {
            if (!dependencyResolver.getRepos().contains(repo)) {
                this.interpreterRepositories.add(repo);
            }
        }
        // repositories have been loaded.
        for (InterpreterSetting setting : interpreterSettings.values()) {
            setting.setDependencies(setting.getDependencies());
        }
    }
}
Also used : RemoteRepository(org.eclipse.aether.repository.RemoteRepository)

Example 64 with RemoteRepository

use of org.eclipse.aether.repository.RemoteRepository in project druid by druid-io.

the class PullDependencies method createTeslaAether.

private DefaultTeslaAether createTeslaAether(List<Repository> remoteRepositories) {
    if (!useProxy) {
        return new DefaultTeslaAether(localRepository, remoteRepositories.toArray(new Repository[0]));
    }
    if (!StringUtils.toLowerCase(proxyType).equals(Proxy.TYPE_HTTP) && !StringUtils.toLowerCase(proxyType).equals(Proxy.TYPE_HTTPS)) {
        throw new IllegalArgumentException("invalid proxy type: " + proxyType);
    }
    RepositorySystemSession repositorySystemSession = new RepositorySystemSessionProvider(new File(localRepository)).get();
    List<RemoteRepository> rl = remoteRepositories.stream().map(r -> {
        RemoteRepository.Builder builder = new RemoteRepository.Builder(r.getId(), "default", r.getUrl());
        if (r.getUsername() != null && r.getPassword() != null) {
            Authentication auth = new AuthenticationBuilder().addUsername(r.getUsername()).addPassword(r.getPassword()).build();
            builder.setAuthentication(auth);
        }
        final Authentication proxyAuth;
        if (Strings.isNullOrEmpty(proxyUsername)) {
            proxyAuth = null;
        } else {
            proxyAuth = new AuthenticationBuilder().addUsername(proxyUsername).addPassword(proxyPassword).build();
        }
        builder.setProxy(new Proxy(proxyType, proxyHost, proxyPort, proxyAuth));
        return builder.build();
    }).collect(Collectors.toList());
    return new DefaultTeslaAether(rl, repositorySystemSession);
}
Also used : Option(com.github.rvesse.airline.annotations.Option) Logger(org.apache.druid.java.util.common.logger.Logger) TeslaAether(io.tesla.aether.TeslaAether) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) DependencyFilterUtils(org.eclipse.aether.util.filter.DependencyFilterUtils) Proxy(org.eclipse.aether.repository.Proxy) Inject(com.google.inject.Inject) URISyntaxException(java.net.URISyntaxException) Dependency(org.eclipse.aether.graph.Dependency) JavaScopes(org.eclipse.aether.util.artifact.JavaScopes) RepositorySystemSession(org.eclipse.aether.RepositorySystemSession) ArrayList(java.util.ArrayList) Strings(com.google.common.base.Strings) ImmutableList(com.google.common.collect.ImmutableList) ExtensionsConfig(org.apache.druid.guice.ExtensionsConfig) URI(java.net.URI) Repository(io.tesla.aether.Repository) Command(com.github.rvesse.airline.annotations.Command) FileUtils(org.apache.druid.java.util.common.FileUtils) ImmutableSetMultimap(com.google.common.collect.ImmutableSetMultimap) CollectRequest(org.eclipse.aether.collection.CollectRequest) OutputStream(java.io.OutputStream) PrintStream(java.io.PrintStream) RepositorySystemSessionProvider(io.tesla.aether.guice.RepositorySystemSessionProvider) DependencyNode(org.eclipse.aether.graph.DependencyNode) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact) StringUtils(org.apache.druid.java.util.common.StringUtils) Artifact(org.eclipse.aether.artifact.Artifact) Set(java.util.Set) ISE(org.apache.druid.java.util.common.ISE) IOException(java.io.IOException) SuppressForbidden(io.netty.util.SuppressForbidden) DependencyRequest(org.eclipse.aether.resolution.DependencyRequest) Collectors(java.util.stream.Collectors) SetMultimap(com.google.common.collect.SetMultimap) File(java.io.File) Authentication(org.eclipse.aether.repository.Authentication) RemoteRepository(org.eclipse.aether.repository.RemoteRepository) AuthenticationBuilder(org.eclipse.aether.util.repository.AuthenticationBuilder) List(java.util.List) VisibleForTesting(com.google.common.annotations.VisibleForTesting) DefaultTeslaAether(io.tesla.aether.internal.DefaultTeslaAether) UnsupportedEncodingException(java.io.UnsupportedEncodingException) RepositorySystemSession(org.eclipse.aether.RepositorySystemSession) AuthenticationBuilder(org.eclipse.aether.util.repository.AuthenticationBuilder) AuthenticationBuilder(org.eclipse.aether.util.repository.AuthenticationBuilder) RemoteRepository(org.eclipse.aether.repository.RemoteRepository) DefaultTeslaAether(io.tesla.aether.internal.DefaultTeslaAether) RepositorySystemSessionProvider(io.tesla.aether.guice.RepositorySystemSessionProvider) Repository(io.tesla.aether.Repository) RemoteRepository(org.eclipse.aether.repository.RemoteRepository) Proxy(org.eclipse.aether.repository.Proxy) Authentication(org.eclipse.aether.repository.Authentication) File(java.io.File)

Example 65 with RemoteRepository

use of org.eclipse.aether.repository.RemoteRepository in project spring-boot by spring-projects.

the class MavenResolverGrapeEngineTests method repositoryAuthentication.

@Test
void repositoryAuthentication() {
    doWithCustomUserHome(() -> {
        List<RemoteRepository> repositories = getRepositories();
        assertThat(repositories).hasSize(1);
        Authentication authentication = repositories.get(0).getAuthentication();
        assertThat(authentication).isNotNull();
    });
}
Also used : Authentication(org.eclipse.aether.repository.Authentication) RemoteRepository(org.eclipse.aether.repository.RemoteRepository) Test(org.junit.jupiter.api.Test)

Aggregations

RemoteRepository (org.eclipse.aether.repository.RemoteRepository)66 File (java.io.File)24 ArrayList (java.util.ArrayList)17 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)16 Artifact (org.eclipse.aether.artifact.Artifact)15 DefaultRepositorySystemSession (org.eclipse.aether.DefaultRepositorySystemSession)13 ArtifactResult (org.eclipse.aether.resolution.ArtifactResult)13 Dependency (org.eclipse.aether.graph.Dependency)12 ArtifactResolutionException (org.eclipse.aether.resolution.ArtifactResolutionException)12 IOException (java.io.IOException)11 List (java.util.List)9 RepositorySystemSession (org.eclipse.aether.RepositorySystemSession)9 MalformedURLException (java.net.MalformedURLException)8 RepositorySystem (org.eclipse.aether.RepositorySystem)8 LocalRepository (org.eclipse.aether.repository.LocalRepository)8 RepositoryPolicy (org.eclipse.aether.repository.RepositoryPolicy)8 CollectRequest (org.eclipse.aether.collection.CollectRequest)7 DependencyFilter (org.eclipse.aether.graph.DependencyFilter)7 ArtifactRequest (org.eclipse.aether.resolution.ArtifactRequest)7 URL (java.net.URL)6