Example usage for org.apache.maven.settings.building StringSettingsSource StringSettingsSource

List of usage examples for org.apache.maven.settings.building StringSettingsSource StringSettingsSource

Introduction

In this page you can find the example usage for org.apache.maven.settings.building StringSettingsSource StringSettingsSource.

Prototype

public StringSettingsSource(CharSequence settings, String location) 

Source Link

Document

Creates a new settings source backed by the specified string.

Usage

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  ww . ja  va  2s  .co 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()));
    }
}