List of usage examples for org.apache.maven.settings.building SettingsBuildingRequest setUserSettingsSource
SettingsBuildingRequest setUserSettingsSource(SettingsSource userSettingsSource);
From source file:org.appformer.maven.integration.embedder.MavenEmbedder.java
License:Apache License
public Settings getSettings() throws MavenEmbedderException, ComponentLookupException { SettingsBuildingRequest settingsBuildingRequest = new DefaultSettingsBuildingRequest(); if (this.mavenRequest.getGlobalSettingsFile() != null) { settingsBuildingRequest.setGlobalSettingsFile(new File(this.mavenRequest.getGlobalSettingsFile())); } else {// w w w . j a v a 2s.c o m settingsBuildingRequest.setGlobalSettingsFile(DEFAULT_GLOBAL_SETTINGS_FILE); } if (this.mavenRequest.getUserSettingsSource() != null) { settingsBuildingRequest.setUserSettingsSource(this.mavenRequest.getUserSettingsSource()); } else { SettingsSource userSettingsSource = MavenSettings.getUserSettingsSource(); if (userSettingsSource != null) { settingsBuildingRequest.setUserSettingsSource(userSettingsSource); } } settingsBuildingRequest.setUserProperties(this.mavenRequest.getUserProperties()); settingsBuildingRequest.getSystemProperties().putAll(System.getProperties()); settingsBuildingRequest.getSystemProperties().putAll(this.mavenRequest.getSystemProperties()); settingsBuildingRequest.getSystemProperties().putAll(getEnvVars()); try { return componentProvider.lookup(SettingsBuilder.class).build(settingsBuildingRequest) .getEffectiveSettings(); } catch (SettingsBuildingException e) { throw new MavenEmbedderException(e.getMessage(), e); } }
From source file:org.hudsonci.maven.eventspy_30.handler.SettingsBuildingRequestHandler.java
License:Open Source License
public void handle(final SettingsBuildingRequest event) throws Exception { log.debug("Settings request: {}", event); DocumentReference document;/*from w w w .j av a 2s . c o m*/ // TODO: Support debug option to write document to disk document = getCallback().getSettingsDocument(); log.debug("Settings document: {}", document); if (document != null) { if (event.getUserSettingsFile() != DEFAULT_USER_SETTINGS_FILE) { log.warn( "Custom settings file configured via command-line as well as via document; document taking precedence"); } log.info("Using settings document ID: {}", document.getId()); log.trace("Content:\n{}", document.getContent()); // FIXME: May contain sensitive data event.setUserSettingsFile(null); event.setUserSettingsSource(new StringSettingsSource(document.getContent(), document.getLocation())); } document = getCallback().getGlobalSettingsDocument(); log.debug("Global settings document: {}", document); if (document != null) { if (event.getGlobalSettingsFile() != DEFAULT_GLOBAL_SETTINGS_FILE) { log.warn( "Custom global settings file configured via command-line as well as via document; document taking precedence"); } log.info("Using global settings document ID: {}", document.getId()); log.trace("Content:\n{}", document.getContent()); // FIXME: May contain sensitive data event.setGlobalSettingsFile(null); event.setGlobalSettingsSource(new StringSettingsSource(document.getContent(), document.getLocation())); } }