Search in sources :

Example 1 with AetherPluginResolverImpl

use of com.buschmais.jqassistant.core.plugin.impl.AetherPluginResolverImpl in project jqa-commandline-tool by jQAssistant.

the class PluginResolverFactory method create.

/**
 * Creates a {@link PluginResolver} using the given {@link CliConfiguration} providing the required {@link Plugin}s and {@link Repositories}
 * <p>
 * The default local repository is ~/.jqassistant/repository.
 * <p>
 * If no remote repository is specified the resolver will use Maven Central, see {@link #CENTRAL}.
 *
 * @param configuration
 *     The {@link CliConfiguration}.
 * @return The {@link PluginResolver}.
 */
public PluginResolver create(CliConfiguration configuration) {
    Repositories repositories = configuration.repositories();
    File localRepository = getLocalRepository(repositories);
    List<RemoteRepository> remoteRepositories = getRemoteRepositories(repositories);
    RepositorySystem repositorySystem = newRepositorySystem();
    log.info("Using local repository '{}' and remote repositories {}.", localRepository, remoteRepositories.stream().map(remoteRepository -> "'" + remoteRepository.getId() + " (" + remoteRepository.getUrl() + ")'").collect(joining(", ")));
    RepositorySystemSession session = newRepositorySystemSession(repositorySystem, localRepository);
    return new AetherPluginResolverImpl(repositorySystem, session, remoteRepositories);
}
Also used : Repositories(com.buschmais.jqassistant.commandline.configuration.Repositories) RepositorySystem(org.eclipse.aether.RepositorySystem) RepositorySystemSession(org.eclipse.aether.RepositorySystemSession) DefaultRepositorySystemSession(org.eclipse.aether.DefaultRepositorySystemSession) AetherPluginResolverImpl(com.buschmais.jqassistant.core.plugin.impl.AetherPluginResolverImpl) RemoteRepository(org.eclipse.aether.repository.RemoteRepository) File(java.io.File)

Example 2 with AetherPluginResolverImpl

use of com.buschmais.jqassistant.core.plugin.impl.AetherPluginResolverImpl in project jqa-maven-plugin by jQAssistant.

the class PluginRepositoryProvider method getPluginRepository.

public synchronized PluginRepository getPluginRepository(RepositorySystem repositorySystem, RepositorySystemSession repositorySystemSession, List<RemoteRepository> repositories, List<Plugin> plugins) {
    if (pluginRepository == null) {
        PluginResolver pluginResolver = new AetherPluginResolverImpl(repositorySystem, repositorySystemSession, repositories);
        PluginClassLoader pluginClassLoader = pluginResolver.createClassLoader(Thread.currentThread().getContextClassLoader(), plugins);
        // do a lazy init of the plugin repo to speed-up if the plugin execution shall be skipped
        PluginConfigurationReader pluginConfigurationReader = new PluginConfigurationReaderImpl(pluginClassLoader);
        this.pluginRepository = new PluginRepositoryImpl(pluginConfigurationReader);
        this.pluginRepository.initialize();
    }
    return pluginRepository;
}
Also used : AetherPluginResolverImpl(com.buschmais.jqassistant.core.plugin.impl.AetherPluginResolverImpl) PluginConfigurationReader(com.buschmais.jqassistant.core.plugin.api.PluginConfigurationReader) PluginResolver(com.buschmais.jqassistant.core.plugin.api.PluginResolver) PluginConfigurationReaderImpl(com.buschmais.jqassistant.core.plugin.impl.PluginConfigurationReaderImpl) PluginClassLoader(com.buschmais.jqassistant.core.plugin.api.PluginClassLoader) PluginRepositoryImpl(com.buschmais.jqassistant.core.plugin.impl.PluginRepositoryImpl)

Aggregations

AetherPluginResolverImpl (com.buschmais.jqassistant.core.plugin.impl.AetherPluginResolverImpl)2 Repositories (com.buschmais.jqassistant.commandline.configuration.Repositories)1 PluginClassLoader (com.buschmais.jqassistant.core.plugin.api.PluginClassLoader)1 PluginConfigurationReader (com.buschmais.jqassistant.core.plugin.api.PluginConfigurationReader)1 PluginResolver (com.buschmais.jqassistant.core.plugin.api.PluginResolver)1 PluginConfigurationReaderImpl (com.buschmais.jqassistant.core.plugin.impl.PluginConfigurationReaderImpl)1 PluginRepositoryImpl (com.buschmais.jqassistant.core.plugin.impl.PluginRepositoryImpl)1 File (java.io.File)1 DefaultRepositorySystemSession (org.eclipse.aether.DefaultRepositorySystemSession)1 RepositorySystem (org.eclipse.aether.RepositorySystem)1 RepositorySystemSession (org.eclipse.aether.RepositorySystemSession)1 RemoteRepository (org.eclipse.aether.repository.RemoteRepository)1