use of org.codehaus.plexus.MutablePlexusContainer 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();
}
}
}
}
Aggregations