EmbulkSystemProperties buildProperties() {
        final Path embulkHome = findEmbulkHome();
        final Properties embulkPropertiesFromFile = loadEmbulkPropertiesFromFile(embulkHome);

        final Path m2Repo = findM2Repo(embulkHome, embulkPropertiesFromFile);
        final Path gemHome = findGemHome(embulkHome, embulkPropertiesFromFile);
        final List<Path> gemPath = findGemPath(embulkHome, embulkPropertiesFromFile);

        final Properties mergedProperties = new Properties();

        // 1) Properties from the "embulk.properties" file are loaded first.
        //
        // Later sources of properties would overwrite it.
        for (final String key : embulkPropertiesFromFile.stringPropertyNames()) {
            mergedProperties.setProperty(key, embulkPropertiesFromFile.getProperty(key));
        }

        // 2) Properties from the command-line are loaded second.
        //
        // It overwrites the properties from "embulk.properties".
        for (final String key : this.commandLineProperties.stringPropertyNames()) {
            mergedProperties.setProperty(key, this.commandLineProperties.getProperty(key));
        }

        // 3) Some specific properties are forcibly overwritten from file/directory lookups.
        mergedProperties.setProperty("embulk_home", embulkHome.toString());
        mergedProperties.setProperty("m2_repo", m2Repo.toString());
        mergedProperties.setProperty("gem_home", gemHome.toString());
        mergedProperties.setProperty(
                "gem_path", gemPath.stream().map(path -> path.toString()).collect(Collectors.joining(File.pathSeparator)));

        if (mergedProperties.getProperty("default_guess_plugins") != null) {
            logger.warn("Embulk system property \"default_guess_plugins\" is unexpectedly set. It is reset.");
            mergedProperties.remove("default_guess_plugins");
        }

        if (this.manifest != null) {
            final Attributes mainAttributes = this.manifest.getMainAttributes();
            if (mainAttributes != null) {
                final String defaultGuessPluginsString = mainAttributes.getValue("Embulk-Default-Guess-Plugins");
                if (defaultGuessPluginsString != null) {
                    final String[] defaultGuessPluginsSpecified = defaultGuessPluginsString.split("\\,");
                    final ArrayList<String> defaultGuessPlugins = new ArrayList<>();
                    for (final String defaultGuessPlugin : defaultGuessPluginsSpecified) {
                        if ("gzip".equals(defaultGuessPlugin)) {
                            final String value = mergedProperties.getProperty("standards.decoder.gzip.disabled");
                            if (value != null && EmbulkSystemProperties.parseBoolean(value, false)) {
                                logger.warn(
                                        "Disabling the standard gzip decoder plugin by the Embulk system property "
                                        + "\"standards.decoder.gzip.disabled\" is deprecated.");
                                continue;
                            }
                        } else if ("bzip2".equals(defaultGuessPlugin)) {
                            final String value = mergedProperties.getProperty("standards.decoder.bzip2.disabled");
                            if (value != null && EmbulkSystemProperties.parseBoolean(value, false)) {
                                logger.warn(
                                        "Disabling the standard bzip2 decoder plugin by the Embulk system property "
                                        + "\"standards.decoder.bzip2.disabled\" is deprecated.");
                                continue;
                            }
                        } else if ("json".equals(defaultGuessPlugin)) {
                            final String value = mergedProperties.getProperty("standards.parser.json.disabled");
                            if (value != null && EmbulkSystemProperties.parseBoolean(value, false)) {
                                logger.warn(
                                        "Disabling the standard JSON parser plugin by the Embulk system property "
                                        + "\"standards.parser.json.disabled\" is deprecated.");
                                continue;
                            }
                        } else if ("csv".equals(defaultGuessPlugin)) {
                            final String value = mergedProperties.getProperty("standards.parser.csv.disabled");
                            if (value != null && EmbulkSystemProperties.parseBoolean(value, false)) {
                                logger.warn(
                                        "Disabling the standard CSV parser plugin by the Embulk system property "
                                        + "\"standards.parser.csv.disabled\" is deprecated.");
                                continue;
                            }
                        }
                        defaultGuessPlugins.add(defaultGuessPlugin);
                    }
                    final String defaultGuessPluginsProperty = String.join(",", defaultGuessPlugins);
                    logger.debug("Embulk system property \"default_guess_plugin\" is set to: \"{}\"", defaultGuessPluginsProperty);
                    mergedProperties.setProperty("default_guess_plugins", defaultGuessPluginsProperty);
                } else {
                    logger.warn("Embulk-Default-Guess-Plugins is not found in the JAR Manifest.");
                }
            } else {
                logger.warn("The JAR Manifest unexpectedly has no main attributes.");
            }
        } else {
            logger.warn("The JAR unexpectedly has no Manifest.");
        }

        return EmbulkSystemProperties.of(mergedProperties);
    }
Builds the eventual Embulk system properties from the command line, environment variables, and the actual file system.
embulk-core/src/main/java/org/embulk/cli/EmbulkSystemPropertiesBuilder.java