use of org.apache.maven.extension.internal.CoreExtensionEntry in project kie-wb-common by kiegroup.
the class AFMavenCli method setupContainerRealm.
protected ClassRealm setupContainerRealm(ClassWorld classWorld, ClassRealm coreRealm, List<File> extClassPath, List<CoreExtensionEntry> extensions) throws Exception {
if (!extClassPath.isEmpty() || !extensions.isEmpty()) {
ClassRealm extRealm = classWorld.newRealm("maven.ext", null);
extRealm.setParentRealm(coreRealm);
slf4jLogger.debug("Populating class realm " + extRealm.getId());
for (File file : extClassPath) {
slf4jLogger.debug(" Included " + file);
extRealm.addURL(file.toURI().toURL());
}
for (CoreExtensionEntry entry : reverse(extensions)) {
Set<String> exportedPackages = entry.getExportedPackages();
ClassRealm realm = entry.getClassRealm();
for (String exportedPackage : exportedPackages) {
extRealm.importFrom(realm, exportedPackage);
}
if (exportedPackages.isEmpty()) {
// sisu uses realm imports to establish component visibility
extRealm.importFrom(realm, realm.getId());
}
}
return extRealm;
}
return coreRealm;
}
use of org.apache.maven.extension.internal.CoreExtensionEntry 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