use of org.eclipse.aether.RepositorySystem in project spring-cloud-function by spring-cloud.
the class DependencyResolutionModule method initialize.
private void initialize() {
if (this.container == null) {
synchronized (lock) {
if (this.container == null) {
ClassWorld classWorld = new ClassWorld("plexus.core", Thread.currentThread().getContextClassLoader());
ContainerConfiguration config = new DefaultContainerConfiguration().setClassWorld(classWorld).setRealm(classWorld.getClassRealm("plexus.core")).setClassPathScanning(PlexusConstants.SCANNING_INDEX).setAutoWiring(true).setName("maven");
PlexusContainer container;
try {
container = new DefaultPlexusContainer(config, new AetherModule(), new DependencyResolutionModule());
localRepositoryManagerFactory = container.lookup(LocalRepositoryManagerFactory.class);
container.addComponent(new ClassRealmManager((MutablePlexusContainer) container, new DefaultBeanLocator()), ClassRealmManager.class.getName());
projectBuilder = container.lookup(ProjectBuilder.class);
repositorySystem = container.lookup(RepositorySystem.class);
} catch (Exception e) {
throw new IllegalStateException("Cannot create container", e);
}
this.container = container;
this.settings = new MavenSettingsReader().readSettings();
}
}
}
}
use of org.eclipse.aether.RepositorySystem in project zeppelin by apache.
the class RepositorySystemFactory method newRepositorySystem.
public static RepositorySystem newRepositorySystem() {
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
exception.printStackTrace();
}
});
RepositorySystem system = locator.getService(RepositorySystem.class);
if (system == null) {
throw new RuntimeException();
}
return system;
}
Aggregations