use of org.codehaus.plexus.logging.BaseLoggerManager in project intellij-community by JetBrains.
the class MavenEmbedder method create.
@NotNull
public static MavenEmbedder create(@NotNull final MavenEmbedderSettings embedderSettings) {
@NotNull final Logger logger = getLogger(embedderSettings);
DefaultPlexusContainer container = new DefaultPlexusContainer();
container.setClassWorld(new ClassWorld("plexus.core", embedderSettings.getClass().getClassLoader()));
container.setLoggerManager(new BaseLoggerManager() {
@Override
protected Logger createLogger(final String s) {
return logger;
}
});
try {
container.initialize();
container.start();
} catch (PlexusContainerException e) {
MavenEmbedderLog.LOG.error(e);
throw new RuntimeException(e);
}
final PlexusComponentConfigurator configurator = embedderSettings.getConfigurator();
if (configurator != null) {
configurator.configureComponents(container);
}
File mavenHome = embedderSettings.getMavenHome();
if (mavenHome != null) {
System.setProperty(PROP_MAVEN_HOME, mavenHome.getPath());
}
Settings nativeSettings = buildSettings(container, embedderSettings);
return new MavenEmbedder(container, nativeSettings, logger, embedderSettings);
}
Aggregations