public void execute()

in core-it-support/core-it-plugins/maven-it-plugin-active-collection/src/main/java/org/apache/maven/plugin/coreit/DumpRepoLayoutsMojo.java [75:122]


    public void execute() throws MojoExecutionException, MojoFailureException {
        Properties layoutProperties = new Properties();

        getLog().info("[MAVEN-CORE-IT-LOG] Dumping repository layouts");

        layoutProperties.setProperty("layouts", Integer.toString(repositoryLayouts.size()));

        for (Object o : repositoryLayouts.keySet()) {
            String roleHint = (String) o;
            Object repoLayout = repositoryLayouts.get(roleHint);
            if (repoLayout != null) {
                layoutProperties.setProperty(
                        "layouts." + roleHint, repoLayout.getClass().getName());
            } else {
                layoutProperties.setProperty("layouts." + roleHint, "");
            }
            getLog().info("[MAVEN-CORE-IT-LOG]   " + roleHint + " = " + repoLayout);
        }

        if (repoLayouts.size() != repositoryLayouts.size()) {
            throw new MojoExecutionException("Inconsistent collection: " + repoLayouts + " vs " + repositoryLayouts);
        }

        if (!layoutsFile.isAbsolute()) {
            layoutsFile = new File(basedir, layoutsFile.getPath());
        }

        getLog().info("[MAVEN-CORE-IT-LOG] Creating output file " + layoutsFile);

        OutputStream out = null;
        try {
            layoutsFile.getParentFile().mkdirs();
            out = new FileOutputStream(layoutsFile);
            layoutProperties.store(out, "MAVEN-CORE-IT-LOG");
        } catch (IOException e) {
            throw new MojoExecutionException("Output file could not be created: " + layoutsFile, e);
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                    // just ignore
                }
            }
        }

        getLog().info("[MAVEN-CORE-IT-LOG] Created output file " + layoutsFile);
    }