use of org.jetbrains.maven.embedder.MavenEmbedderSettings in project intellij-community by JetBrains.
the class Maven2ServerEmbedderImpl method create.
public static Maven2ServerEmbedderImpl create(MavenServerSettings facadeSettings) throws RemoteException {
MavenEmbedderSettings settings = new MavenEmbedderSettings();
List<String> commandLineOptions = new ArrayList<String>();
String mavenEmbedderCliOptions = System.getProperty(MavenServerEmbedder.MAVEN_EMBEDDER_CLI_ADDITIONAL_ARGS);
if (mavenEmbedderCliOptions != null) {
commandLineOptions.addAll(StringUtil.splitHonorQuotes(mavenEmbedderCliOptions, ' '));
}
settings.setConfigurator(new PlexusComponentConfigurator() {
public void configureComponents(@NotNull PlexusContainer c) {
setupContainer(c);
}
});
Maven2ServerConsoleWrapper consoleWrapper = new Maven2ServerConsoleWrapper();
consoleWrapper.setThreshold(facadeSettings.getLoggingLevel());
settings.setLogger(consoleWrapper);
settings.setRecursive(false);
settings.setWorkOffline(facadeSettings.isOffline());
settings.setUsePluginRegistry(false);
settings.setMavenHome(facadeSettings.getMavenHome());
settings.setUserSettingsFile(facadeSettings.getUserSettingsFile());
settings.setGlobalSettingsFile(facadeSettings.getGlobalSettingsFile());
settings.setLocalRepository(facadeSettings.getLocalRepository());
if (commandLineOptions.contains("-U") || commandLineOptions.contains("--update-snapshots")) {
settings.setSnapshotUpdatePolicy(MavenEmbedderSettings.UpdatePolicy.ALWAYS_UPDATE);
} else {
settings.setSnapshotUpdatePolicy(convertUpdatePolicy(facadeSettings.getSnapshotUpdatePolicy()));
}
settings.setPluginUpdatePolicy(convertUpdatePolicy(facadeSettings.getPluginUpdatePolicy()));
settings.setProperties(MavenServerUtil.collectSystemProperties());
return new Maven2ServerEmbedderImpl(MavenEmbedder.create(settings), consoleWrapper);
}
Aggregations