public void execute()

in enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/RequireActiveProfile.java [72:103]


    public void execute() throws EnforcerRuleException {
        List<String> missingProfiles = new ArrayList<>();
        if (profiles != null && !profiles.isEmpty()) {
            String[] profileIds = profiles.split(",");
            for (String profileId : profileIds) {
                if (!isProfileActive(project, profileId)) {
                    missingProfiles.add(profileId);
                }
            }

            boolean fail = false;
            if (!missingProfiles.isEmpty()) {
                if (all || missingProfiles.size() == profileIds.length) {
                    fail = true;
                }
            }

            if (fail) {
                String message = getMessage();
                StringBuilder buf = new StringBuilder();
                if (message != null) {
                    buf.append(message + System.lineSeparator());
                }

                for (String profile : missingProfiles) {
                    buf.append("Profile \"" + profile + "\" is not activated." + System.lineSeparator());
                }

                throw new EnforcerRuleException(buf.toString());
            }
        }
    }