public void execute()

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


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

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

        componentProperties.setProperty("count", Integer.toString(componentList.size()));

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

        for (int i = componentList.size() - 1; i >= 0; i--) {
            Object component = componentList.get(i);

            if (component != componentList.get(i)) {
                throw new MojoExecutionException("Invalid re-lookup of component from list: " + i);
            }
        }

        int i = 0;
        for (Iterator it = componentMap.keySet().iterator(); it.hasNext(); i++) {
            String roleHint = (String) it.next();
            componentProperties.setProperty("component." + i + ".hint", roleHint);

            Object component = componentMap.get(roleHint);

            if (component != null) {
                String hash = Integer.toString(System.identityHashCode(component));
                componentProperties.setProperty("component." + i + ".hash", hash);
                componentProperties.setProperty("component." + roleHint + ".hash", hash);
            }

            if (component != componentMap.get(roleHint)) {
                throw new MojoExecutionException("Invalid re-lookup of component from map: " + roleHint);
            }

            getLog().info("[MAVEN-CORE-IT-LOG]   " + roleHint + " = " + component);
        }

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

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

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

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