use of com.buschmais.jqassistant.core.plugin.api.PluginResolver in project jqa-commandline-tool by jQAssistant.
the class CliPluginResolverIT method resolve.
@Test
void resolve() {
Map<String, String> configurationProperties = new HashMap<>();
configurationProperties.put("jqassistant.plugins[0].group-id", "org.jqassistant.contrib.plugin");
configurationProperties.put("jqassistant.plugins[0].artifact-id", "jqassistant-docker-plugin");
configurationProperties.put("jqassistant.plugins[0].version", "1.11.0");
PropertiesConfigSource testConfigSource = new PropertiesConfigSource(configurationProperties, "TestConfigSource", 110);
ConfigurationLoaderImpl configurationLoader = new ConfigurationLoaderImpl(new File("src/test/resources"));
CliConfiguration cliConfiguration = configurationLoader.load(CliConfiguration.class, testConfigSource);
PluginResolverFactory pluginResolverFactory = new PluginResolverFactory();
PluginResolver pluginResolver = pluginResolverFactory.create(cliConfiguration);
PluginClassLoader pluginClassLoader = pluginResolver.createClassLoader(PluginResolverFactory.class.getClassLoader(), cliConfiguration.plugins());
assertThat(pluginClassLoader).isNotNull();
}
use of com.buschmais.jqassistant.core.plugin.api.PluginResolver in project jqa-commandline-tool by jQAssistant.
the class Main method getPluginRepository.
/**
* Initialize the plugin repository.
*
* @param configuration
* The {@link CliConfiguration}
* @return The repository.
* @throws CliExecutionException
* If initialization fails.
*/
private PluginRepository getPluginRepository(CliConfiguration configuration) throws CliExecutionException {
// create classloader for the plugins/ directory.
ClassLoader pluginDirectoryClassLoader = createPluginClassLoader();
PluginResolverFactory pluginResolverFactory = new PluginResolverFactory();
PluginResolver pluginResolver = pluginResolverFactory.create(configuration);
// create plugin classloader using classloader for plugins/ directory as parent, adding plugins to be resolved frol PluginResolver
PluginClassLoader pluginClassLoader = pluginResolver.createClassLoader(pluginDirectoryClassLoader, configuration.plugins());
PluginConfigurationReader pluginConfigurationReader = new PluginConfigurationReaderImpl(pluginClassLoader);
return new PluginRepositoryImpl(pluginConfigurationReader);
}
use of com.buschmais.jqassistant.core.plugin.api.PluginResolver 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;
}
Aggregations