Ejemplo n.º 1
0
  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);
        }
      }
    }

    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 = CLIReportingUtils.getBuildProperties();

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

    String mavenBuildVersion = CLIReportingUtils.createMavenVersionString(buildProperties);
    systemProperties.setProperty("maven.build.version", mavenBuildVersion);
  }
Ejemplo n.º 2
0
 public static void populateSystemProperties(MavenExecutionRequest request) {
   // temporary solution for https://issues.sonatype.org/browse/MNGECLIPSE-1607
   // oddly, there are no unit tests that fail if this is commented out
   Properties systemProperties = new Properties();
   EnvironmentUtils.addEnvVars(systemProperties);
   systemProperties.putAll(System.getProperties());
   request.setSystemProperties(systemProperties);
 }
  private ProjectBuildingRequest injectSession(ProjectBuildingRequest request) {
    MavenSession session = legacySupport.getSession();
    if (session != null) {
      request.setRepositorySession(session.getRepositorySession());
      request.setSystemProperties(session.getSystemProperties());
      if (request.getUserProperties().isEmpty()) {
        request.setUserProperties(session.getUserProperties());
      }

      MavenExecutionRequest req = session.getRequest();
      if (req != null) {
        request.setRemoteRepositories(req.getRemoteRepositories());
      }
    } else {
      Properties props = new Properties();
      EnvironmentUtils.addEnvVars(props);
      props.putAll(System.getProperties());
      request.setSystemProperties(props);
    }

    return request;
  }
Ejemplo n.º 4
0
  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 (int i = 0; i < defStrs.length; ++i) {
          setCliProperty(defStrs[i], userProperties);
        }
      }
    }

    systemProperties.putAll(System.getProperties());
  }