private Properties getUserProperties()

in src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java [2042:2071]


    private Properties getUserProperties(final File basedir, final String filename) throws MojoExecutionException {
        Properties collectedTestProperties = new Properties();

        if (properties != null) {
            // MINVOKER-118: property can have empty value, which is not accepted by collectedTestProperties
            for (Map.Entry<String, String> entry : properties.entrySet()) {
                if (entry.getValue() != null) {
                    collectedTestProperties.put(entry.getKey(), entry.getValue());
                }
            }
        }

        File propertiesFile = null;
        if (filename != null) {
            propertiesFile = new File(basedir, filename);
        }

        if (propertiesFile != null && propertiesFile.isFile()) {

            try (InputStream fin = Files.newInputStream(propertiesFile.toPath())) {
                Properties loadedProperties = new Properties();
                loadedProperties.load(fin);
                collectedTestProperties.putAll(loadedProperties);
            } catch (IOException e) {
                throw new MojoExecutionException("Error reading user properties from " + propertiesFile);
            }
        }

        return collectedTestProperties;
    }