org.eclipse.aether.RepositoryListener Java Examples

The following examples show how to use org.eclipse.aether.RepositoryListener. 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: Util.java    From galleon with Apache License 2.0 5 votes vote down vote up
public static RepositorySystemSession newRepositorySession(final RepositorySystem repoSystem,
        Path path, RepositoryListener listener, ProxySelector proxySelector, boolean offline) {
    final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
    session.setRepositoryListener(listener);
    session.setOffline(offline);
    final LocalRepository localRepo = new LocalRepository(path.toString());
    session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, localRepo));
    if (proxySelector != null) {
        session.setProxySelector(proxySelector);
    }
    return session;
}
 
Example #2
Source File: MavenMvnSettings.java    From galleon with Apache License 2.0 5 votes vote down vote up
MavenMvnSettings(MavenConfig config, RepositorySystem repoSystem, RepositoryListener listener) throws ArtifactException {
    this.config = config;
    Settings settings = buildMavenSettings(config.getSettings());
    Proxy proxy = settings.getActiveProxy();
    if (proxy != null) {
        MavenProxySelector.Builder builder = new MavenProxySelector.Builder(proxy.getHost(), proxy.getPort(), proxy.getProtocol());
        builder.setPassword(proxy.getPassword());
        builder.setUserName(proxy.getUsername());
        if (proxy.getNonProxyHosts() != null) {
            String[] hosts = proxy.getNonProxyHosts().split("\\|");
            builder.addNonProxyHosts(Arrays.asList(hosts));
        }
        proxySelector = builder.build();
        Authentication auth = null;
        if (proxy.getPassword() != null && proxy.getUsername() != null) {
            auth = new AuthenticationBuilder().addUsername(proxy.getUsername()).addPassword(proxy.getPassword()).build();
        }
        this.proxy = new org.eclipse.aether.repository.Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth);
    } else {
        this.proxy = null;
        proxySelector = null;
    }
    try {
        repositories = Collections.unmodifiableList(buildRemoteRepositories(settings));
    } catch (MalformedURLException ex) {
        throw new ArtifactException(ex.getMessage(), ex);
    }
    session = Util.newRepositorySession(repoSystem,
            settings.getLocalRepository() == null ? config.getLocalRepository() : Paths.get(settings.getLocalRepository()),
            listener, proxySelector, settings.isOffline());
}
 
Example #3
Source File: MavenConfig.java    From galleon with Apache License 2.0 5 votes vote down vote up
public MavenSettings buildSettings(RepositorySystem repoSystem,
        RepositoryListener listener) throws ArtifactException {
    if (reuseMavenSettings()) {
        return new MavenMvnSettings(this, repoSystem, listener);
    } else {
        return new MavenCliSettings(this, repoSystem, listener);
    }
}
 
Example #4
Source File: CliMavenArtifactRepositoryManager.java    From galleon with Apache License 2.0 4 votes vote down vote up
CliMavenArtifactRepositoryManager(MavenConfig config, RepositoryListener listener) {
    super(Util.newRepositorySystem());
    this.config = config;
    this.listener = listener;
}
 
Example #5
Source File: MavenCliSettings.java    From galleon with Apache License 2.0 4 votes vote down vote up
MavenCliSettings(MavenConfig config, RepositorySystem repoSystem, RepositoryListener listener) throws ArtifactException {
    repositories = Collections.unmodifiableList(buildRepositories(config));
    MavenProxySelector proxySelector = null;
    session = Util.newRepositorySession(repoSystem, config.getLocalRepository(),
            listener, proxySelector, config.isOffline());
}
 
Example #6
Source File: RepositorySystemSessionWrapper.java    From wildfly-swarm with Apache License 2.0 4 votes vote down vote up
@Override
public RepositoryListener getRepositoryListener() {
    return delegate.getRepositoryListener();
}
 
Example #7
Source File: ShrinkwrapArtifactResolvingHelper.java    From thorntail with Apache License 2.0 4 votes vote down vote up
public ShrinkwrapArtifactResolvingHelper repositoryListener(final RepositoryListener l) {
    this.repositoryListener = l;

    return this;
}
 
Example #8
Source File: RepositorySystemSessionWrapper.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@Override
public RepositoryListener getRepositoryListener() {
    return delegate.getRepositoryListener();
}
 
Example #9
Source File: ShrinkwrapArtifactResolvingHelper.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 4 votes vote down vote up
public ShrinkwrapArtifactResolvingHelper repositoryListener(final RepositoryListener l) {
    this.repositoryListener = l;

    return this;
}