private InvokerProperties getInvokerProperties()

in src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java [2367:2413]


    private InvokerProperties getInvokerProperties(final File projectDirectory, Properties globalInvokerProperties)
            throws MojoExecutionException {
        Properties props;
        if (globalInvokerProperties != null) {
            props = new Properties(globalInvokerProperties);
        } else {
            props = new Properties();
        }

        File propertiesFile = new File(projectDirectory, invokerPropertiesFile);
        if (propertiesFile.isFile()) {
            try (InputStream in = new FileInputStream(propertiesFile)) {
                props.load(in);
            } catch (IOException e) {
                throw new MojoExecutionException("Failed to read invoker properties: " + propertiesFile, e);
            }
        }

        Interpolator interpolator = new RegexBasedInterpolator();
        interpolator.addValueSource(new MapBasedValueSource(getInterpolationValueSource(false)));
        // CHECKSTYLE_OFF: LineLength
        for (String key : props.stringPropertyNames()) {
            String value = props.getProperty(key);
            try {
                value = interpolator.interpolate(value, "");
            } catch (InterpolationException e) {
                throw new MojoExecutionException("Failed to interpolate invoker properties: " + propertiesFile, e);
            }
            props.setProperty(key, value);
        }

        InvokerProperties invokerProperties = new InvokerProperties(props);

        // set default value for Invoker - it will be used if not present in properties
        invokerProperties.setDefaultDebug(debug);
        invokerProperties.setDefaultQuiet(quiet);
        invokerProperties.setDefaultGoals(goals);
        invokerProperties.setDefaultProfiles(profiles);
        invokerProperties.setDefaultMavenExecutable(mavenExecutable);
        invokerProperties.setDefaultMavenOpts(interpolatorUtils.interpolateAtPattern(mavenOpts));
        invokerProperties.setDefaultTimeoutInSeconds(timeoutInSeconds);
        invokerProperties.setDefaultEnvironmentVariables(environmentVariables);
        invokerProperties.setDefaultUpdateSnapshots(updateSnapshots);
        invokerProperties.setDefaultUserPropertiesFiles(testPropertiesFile);

        return invokerProperties;
    }