private boolean prepareGoals()

in src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java [231:267]


    private boolean prepareGoals(
            ReportPlugin reportPlugin, PluginDescriptor pluginDescriptor, List<GoalWithConf> goalsWithConfiguration) {
        if (reportPlugin.getReportSets().isEmpty() && reportPlugin.getReports().isEmpty()) {
            // by default, use every goal which will be filtered later to only keep reporting goals
            List<MojoDescriptor> mojoDescriptors = pluginDescriptor.getMojos();
            for (MojoDescriptor mojoDescriptor : mojoDescriptors) {
                goalsWithConfiguration.add(new GoalWithConf(
                        reportPlugin, pluginDescriptor, mojoDescriptor.getGoal(), mojoDescriptor.getConfiguration()));
            }

            return false;
        }

        Set<String> goals = new HashSet<>();
        for (String report : reportPlugin.getReports()) {
            if (goals.add(report)) {
                goalsWithConfiguration.add(
                        new GoalWithConf(reportPlugin, pluginDescriptor, report, reportPlugin.getConfiguration()));
            } else {
                LOGGER.warn("{} report is declared twice in default reports", report);
            }
        }

        for (ReportSet reportSet : reportPlugin.getReportSets()) {
            goals = new HashSet<>();
            for (String report : reportSet.getReports()) {
                if (goals.add(report)) {
                    goalsWithConfiguration.add(
                            new GoalWithConf(reportPlugin, pluginDescriptor, report, reportSet.getConfiguration()));
                } else {
                    LOGGER.warn("{} report is declared twice in {} reportSet", report, reportSet.getId());
                }
            }
        }

        return true;
    }