public void execute()

in src/main/java/org/apache/maven/plugins/help/AllProfilesMojo.java [67:104]


    public void execute() throws MojoExecutionException, MojoFailureException {
        StringBuilder descriptionBuffer = new StringBuilder();

        for (MavenProject project : projects) {
            descriptionBuffer
                    .append("Listing Profiles for Project: ")
                    .append(project.getId())
                    .append(LS);

            Map<String, Profile> allProfilesByIds = new HashMap<>();
            Map<String, Profile> activeProfilesByIds = new HashMap<>();
            addSettingsProfiles(allProfilesByIds);
            addProjectPomProfiles(project, allProfilesByIds, activeProfilesByIds);

            // now display
            if (allProfilesByIds.isEmpty()) {
                getLog().warn("No profiles detected!");
            } else {
                // active Profiles will be a subset of *all* profiles
                allProfilesByIds.keySet().removeAll(activeProfilesByIds.keySet());

                writeProfilesDescription(descriptionBuffer, activeProfilesByIds, true);
                writeProfilesDescription(descriptionBuffer, allProfilesByIds, false);
            }
        }

        if (output != null) {
            try {
                writeFile(output, descriptionBuffer);
            } catch (IOException e) {
                throw new MojoExecutionException("Cannot write profiles description to output: " + output, e);
            }

            getLog().info("Wrote descriptions to: " + output);
        } else {
            getLog().info(descriptionBuffer.toString());
        }
    }