Example usage for org.apache.maven.properties.internal SystemProperties addSystemProperties

List of usage examples for org.apache.maven.properties.internal SystemProperties addSystemProperties

Introduction

In this page you can find the example usage for org.apache.maven.properties.internal SystemProperties addSystemProperties.

Prototype

public static void addSystemProperties(Properties props) 

Source Link

Document

Thread-safe System.properties copy implementation.

Usage

From source file:org.kie.workbench.common.services.backend.compiler.external339.AFMavenCli.java

License:Apache License

static void populateProperties(CommandLine commandLine, Properties systemProperties,
        Properties userProperties) {

    EnvironmentUtils.addEnvVars(systemProperties);

    // ----------------------------------------------------------------------
    // Options that are set on the command line become system properties
    // and therefore are set in the session properties. System properties
    // are most dominant.
    // ----------------------------------------------------------------------

    if (commandLine.hasOption(CLIManager.SET_SYSTEM_PROPERTY)) {
        String[] defStrs = commandLine.getOptionValues(CLIManager.SET_SYSTEM_PROPERTY);

        if (defStrs != null) {
            for (String defStr : defStrs) {
                setCliProperty(defStr, userProperties);
            }/*w w w  .  j  a va2  s  .  c  om*/
        }
    }

    SystemProperties.addSystemProperties(systemProperties);

    // ----------------------------------------------------------------------
    // Properties containing info about the currently running version of Maven
    // These override any corresponding properties set on the command line
    // ----------------------------------------------------------------------

    Properties buildProperties = AFCLIReportingUtils.getBuildProperties();

    String mavenVersion = buildProperties.getProperty(AFCLIReportingUtils.BUILD_VERSION_PROPERTY);
    systemProperties.setProperty("maven.version", mavenVersion);

    String mavenBuildVersion = AFCLIReportingUtils.createMavenVersionString(buildProperties);
    systemProperties.setProperty("maven.build.version", mavenBuildVersion);
}

From source file:org.kie.workbench.common.services.backend.compiler.impl.external339.ReusableAFMavenCli.java

License:Apache License

static void populateProperties(CommandLine commandLine, Properties systemProperties, Properties userProperties,
        Properties bannedEnvVars) {

    EnvironmentUtils.addEnvVars(systemProperties);

    // ----------------------------------------------------------------------
    // Options that are set on the command line become system properties
    // and therefore are set in the session properties. System properties
    // are most dominant.
    // ----------------------------------------------------------------------

    if (commandLine.hasOption(CLIManager.SET_SYSTEM_PROPERTY)) {
        String[] defStrs = commandLine.getOptionValues(CLIManager.SET_SYSTEM_PROPERTY);

        if (defStrs != null) {
            for (String defStr : defStrs) {
                setCliProperty(defStr, userProperties);
            }//  w ww  .  ja va 2 s .  c om
        }
    }

    SystemProperties.addSystemProperties(systemProperties);
    purgeBannedProperties(systemProperties, bannedEnvVars);// purged from the env vars who breaks the build

    // ----------------------------------------------------------------------
    // Properties containing info about the currently running version of Maven
    // These override any corresponding properties set on the command line
    // ----------------------------------------------------------------------

    Properties buildProperties = AFCLIReportingUtils.getBuildProperties();

    String mavenVersion = buildProperties.getProperty(AFCLIReportingUtils.BUILD_VERSION_PROPERTY);
    systemProperties.setProperty("maven.version", mavenVersion);

    String mavenBuildVersion = AFCLIReportingUtils.createMavenVersionString(buildProperties);
    systemProperties.setProperty("maven.build.version", mavenBuildVersion);
}