use of org.codehaus.plexus.classworlds.realm.NoSuchRealmException in project sts4 by spring-projects.
the class MavenBridge method newPlexusContainer.
private static DefaultPlexusContainer newPlexusContainer() throws PlexusContainerException {
final ClassWorld classWorld = new ClassWorld(MAVEN_CORE_REALM_ID, ClassWorld.class.getClassLoader());
final ClassRealm realm;
try {
realm = classWorld.getRealm(MAVEN_CORE_REALM_ID);
} catch (NoSuchRealmException e) {
throw new PlexusContainerException("Could not lookup required class realm", e);
}
final ContainerConfiguration mavenCoreCC = //
new DefaultContainerConfiguration().setClassWorld(//
classWorld).setRealm(//
realm).setClassPathScanning(//
PlexusConstants.SCANNING_INDEX).setAutoWiring(//
true).setName(// $NON-NLS-1$
"mavenCore");
final Module logginModule = new AbstractModule() {
protected void configure() {
bind(ILoggerFactory.class).toInstance(LoggerFactory.getILoggerFactory());
}
};
final Module coreExportsModule = new AbstractModule() {
protected void configure() {
ClassRealm realm = mavenCoreCC.getRealm();
CoreExtensionEntry entry = CoreExtensionEntry.discoverFrom(realm);
CoreExports exports = new CoreExports(entry);
bind(CoreExports.class).toInstance(exports);
}
};
return new DefaultPlexusContainer(mavenCoreCC, logginModule, coreExportsModule);
}
Aggregations