public void validate()

in compat/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java [52:164]


    public void validate(Settings settings, SettingsProblemCollector problems) {
        if (settings.isUsePluginRegistry()) {
            addViolation(problems, Severity.WARNING, "usePluginRegistry", null, "is deprecated and has no effect.");
        }

        List<String> pluginGroups = settings.getPluginGroups();

        if (pluginGroups != null) {
            for (int i = 0; i < pluginGroups.size(); i++) {
                String pluginGroup = pluginGroups.get(i).trim();

                if (pluginGroup.isEmpty()) {
                    addViolation(
                            problems, Severity.ERROR, "pluginGroups.pluginGroup[" + i + "]", null, "must not be empty");
                } else if (!ID_REGEX.matcher(pluginGroup).matches()) {
                    addViolation(
                            problems,
                            Severity.ERROR,
                            "pluginGroups.pluginGroup[" + i + "]",
                            null,
                            "must denote a valid group id and match the pattern " + ID);
                }
            }
        }

        List<Server> servers = settings.getServers();

        if (servers != null) {
            Set<String> serverIds = new HashSet<>();

            for (int i = 0; i < servers.size(); i++) {
                Server server = servers.get(i);

                validateStringNotEmpty(problems, "servers.server[" + i + "].id", server.getId(), null);

                if (!serverIds.add(server.getId())) {
                    addViolation(
                            problems,
                            Severity.WARNING,
                            "servers.server.id",
                            null,
                            "must be unique but found duplicate server with id " + server.getId());
                }
            }
        }

        List<Mirror> mirrors = settings.getMirrors();

        if (mirrors != null) {
            for (Mirror mirror : mirrors) {
                validateStringNotEmpty(problems, "mirrors.mirror.id", mirror.getId(), mirror.getUrl());

                validateBannedCharacters(
                        problems, "mirrors.mirror.id", Severity.WARNING, mirror.getId(), null, ILLEGAL_REPO_ID_CHARS);

                if ("local".equals(mirror.getId())) {
                    addViolation(
                            problems,
                            Severity.WARNING,
                            "mirrors.mirror.id",
                            null,
                            "must not be 'local'"
                                    + ", this identifier is reserved for the local repository"
                                    + ", using it for other repositories will corrupt your repository metadata.");
                }

                validateStringNotEmpty(problems, "mirrors.mirror.url", mirror.getUrl(), mirror.getId());

                validateStringNotEmpty(problems, "mirrors.mirror.mirrorOf", mirror.getMirrorOf(), mirror.getId());
            }
        }

        List<Profile> profiles = settings.getProfiles();

        if (profiles != null) {
            Set<String> profileIds = new HashSet<>();

            for (Profile profile : profiles) {
                if (!profileIds.add(profile.getId())) {
                    addViolation(
                            problems,
                            Severity.WARNING,
                            "profiles.profile.id",
                            null,
                            "must be unique but found duplicate profile with id " + profile.getId());
                }

                String prefix = "profiles.profile[" + profile.getId() + "].";

                validateRepositories(problems, profile.getRepositories(), prefix + "repositories.repository");
                validateRepositories(
                        problems, profile.getPluginRepositories(), prefix + "pluginRepositories.pluginRepository");
            }
        }

        List<Proxy> proxies = settings.getProxies();

        if (proxies != null) {
            Set<String> proxyIds = new HashSet<>();

            for (Proxy proxy : proxies) {
                if (!proxyIds.add(proxy.getId())) {
                    addViolation(
                            problems,
                            Severity.WARNING,
                            "proxies.proxy.id",
                            null,
                            "must be unique but found duplicate proxy with id " + proxy.getId());
                }
                validateStringNotEmpty(problems, "proxies.proxy.host", proxy.getHost(), proxy.getId());
            }
        }
    }