Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-8615] [MNG-8616] Maven core extensions handling improvements #2147

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ protected DefaultPlexusContainer container(LookupInvoker<C> invoker, C context)
}
return value;
};
ArrayList<Throwable> throwables = new ArrayList<>();
for (CoreExtensionEntry extension : extensions) {
container.discoverComponents(
extension.getClassRealm(),
Expand All @@ -122,15 +123,20 @@ protected void configure() {
try {
container.lookup(Injector.class).discover(extension.getClassRealm());
} catch (Throwable e) {
context.logger.warn("Maven DI failure", e);
throwables.add(e);
}
}
},
new SessionScopeModule(container.lookup(SessionScope.class)),
new MojoExecutionScopeModule(container.lookup(MojoExecutionScope.class)),
new ExtensionConfigurationModule(extension, extensionSource));
}

if (!throwables.isEmpty()) {
IllegalStateException mavenDiFailed = new IllegalStateException(
"Maven dependency injection failed for at least one of the registered core extension");
throwables.forEach(mavenDiFailed::addSuppressed);
throw mavenDiFailed;
}
container.getLoggerManager().setThresholds(toPlexusLoggingLevel(context.loggerLevel));
customizeContainer(context, container);

Expand Down