public static Map getSystemProperties()

in maven-wrapper/src/main/java/org/apache/maven/wrapper/SystemPropertiesHandler.java [39:61]


    public static Map<String, String> getSystemProperties(Path propertiesFile) {
        Map<String, String> propertyMap = new HashMap<>();
        if (!Files.isRegularFile(propertiesFile)) {
            return propertyMap;
        }
        Properties properties = new Properties();
        try (InputStream inStream = Files.newInputStream(propertiesFile)) {
            properties.load(inStream);
        } catch (IOException e) {
            throw new RuntimeException("Error when loading properties file=" + propertiesFile, e);
        }

        for (Entry<Object, Object> entrySet : properties.entrySet()) {
            Matcher matcher = SYSPROP_PATTERN.matcher(entrySet.getKey().toString());
            if (matcher.find()) {
                String key = matcher.group(1);
                if (key.length() > 0) {
                    propertyMap.put(key, entrySet.getValue().toString());
                }
            }
        }
        return propertyMap;
    }