Java Code Examples for org.eclipse.aether.DefaultRepositorySystemSession#setRepositoryListener()

The following examples show how to use org.eclipse.aether.DefaultRepositorySystemSession#setRepositoryListener() . 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: Booter.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
public static DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system)
{
    DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();

    LocalRepository localRepo = new LocalRepository("target/local-repo");
    session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));

    session.setTransferListener(new ConsoleTransferListener());
    session.setRepositoryListener(new ConsoleRepositoryListener());

    // uncomment to generate dirty trees
    // session.setDependencyGraphTransformer( null );

    return session;
}
 
Example 3
Source File: MavenArtifactResolver.java    From spring-cloud-deployer with Apache License 2.0 5 votes vote down vote up
private DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system, String localRepoPath) {
	DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
	LocalRepository localRepo = new LocalRepository(localRepoPath);
	session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
	session.setOffline(this.properties.isOffline());
	session.setUpdatePolicy(this.properties.getUpdatePolicy());
	session.setChecksumPolicy(this.properties.getChecksumPolicy());
	if (this.properties.isEnableRepositoryListener()) {
		session.setRepositoryListener(new LoggingRepositoryListener());
	}
	if (this.properties.getConnectTimeout() != null) {
		session.setConfigProperty(ConfigurationProperties.CONNECT_TIMEOUT, this.properties.getConnectTimeout());
	}
	if (this.properties.getRequestTimeout() != null) {
		session.setConfigProperty(ConfigurationProperties.REQUEST_TIMEOUT, this.properties.getRequestTimeout());
	}
	if (isProxyEnabled()) {
		DefaultProxySelector proxySelector = new DefaultProxySelector();
		Proxy proxy = new Proxy(this.properties.getProxy().getProtocol(),
				this.properties.getProxy().getHost(),
				this.properties.getProxy().getPort(),
				this.proxyAuthentication);
		proxySelector.add(proxy, this.properties.getProxy().getNonProxyHosts());
		session.setProxySelector(proxySelector);
	}
	// wagon configs
	for (Entry<String, MavenProperties.RemoteRepository> entry : this.properties.getRemoteRepositories().entrySet()) {
		session.setConfigProperty("aether.connector.wagon.config." + entry.getKey(), entry.getValue().getWagon());
	}
	return session;
}
 
Example 4
Source File: RepositoryHandler.java    From maven-repository-tools with Eclipse Public License 1.0 5 votes vote down vote up
private static DefaultRepositorySystemSession newRepositorySystemSession( RepositorySystem system, 
                                                                         File localRepoPath )
{
    DefaultRepositorySystemSession newSession = MavenRepositorySystemUtils.newSession();

    LocalRepository localRepo = new LocalRepository( localRepoPath );
    newSession.setLocalRepositoryManager( system.newLocalRepositoryManager( newSession, localRepo ) );

    newSession.setTransferListener( getTransferListener() );
    newSession.setRepositoryListener( repositoryListener );

    return newSession;
}
 
Example 5
Source File: ArtifactTransporter.java    From jenkins-build-monitor-plugin with MIT License 5 votes vote down vote up
private DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system) {
    DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();

    LocalRepository localRepo = new LocalRepository(localRepositoryLocation.toAbsolutePath().toString());
    session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));

    session.setTransferListener(new ConsoleTransferListener());
    session.setRepositoryListener(new ConsoleRepositoryListener());

    return session;
}
 
Example 6
Source File: RemotePluginRepository.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
public static DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system) {
	DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();

	LocalRepository localRepo = new LocalRepository("target/local-repo");
	session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));

	session.setTransferListener(new ConsoleTransferListener());
	session.setRepositoryListener(new ConsoleRepositoryListener());

	// uncomment to generate dirty trees
	// session.setDependencyGraphTransformer( null );

	return session;
}
 
Example 7
Source File: ShrinkwrapArtifactResolvingHelper.java    From thorntail with Apache License 2.0 4 votes vote down vote up
private void resetListeners() {
    final DefaultRepositorySystemSession session = session();
    session.setRepositoryListener(this.repositoryListener);
    session.setTransferListener(this.transferListener);
}
 
Example 8
Source File: ShrinkwrapArtifactResolvingHelper.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 4 votes vote down vote up
private void resetListeners() {
    final DefaultRepositorySystemSession session = session();
    session.setRepositoryListener(this.repositoryListener);
    session.setTransferListener(this.transferListener);
}
 
Example 9
Source File: ArtifactResolverTest.java    From revapi with Apache License 2.0 3 votes vote down vote up
public static DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system,
        File localRepoLocation) {

    DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();

    LocalRepository localRepo = new LocalRepository(localRepoLocation);
    session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));

    session.setTransferListener(new AbstractTransferListener() {});
    session.setRepositoryListener(new AbstractRepositoryListener() {});

    return session;
}