public boolean hasValidVersionSpecified()

in enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/RequirePluginVersions.java [516:561]


    public boolean hasValidVersionSpecified(Plugin source, List<PluginWrapper> pluginWrappers) {
        boolean found = false;
        boolean status = false;
        for (PluginWrapper plugin : pluginWrappers) {
            // find the matching plugin entry
            if (isMatchingPlugin(source, plugin)) {
                found = true;
                // found the entry. now see if the version is specified
                String version = plugin.getVersion();
                try {
                    version = (String) evaluator.evaluate(version);
                } catch (ExpressionEvaluationException e) {
                    return false;
                }

                if (isValidVersion(version)) {
                    getLog().debug("checking for notEmpty and notIsWhitespace(): " + version);
                    if (banRelease && version.equals("RELEASE")) {
                        return false;
                    }

                    if (banLatest && version.equals("LATEST")) {
                        return false;
                    }

                    if (banSnapshots && isSnapshot(version)) {
                        return false;
                    }
                    // the version was specified and not
                    // banned. It's ok. Keep looking through the list to make
                    // sure it's not using a banned version somewhere else.

                    status = true;

                    if (!banRelease && !banLatest && !banSnapshots) {
                        // no need to keep looking
                        break;
                    }
                }
            }
        }
        if (!found) {
            getLog().debug("plugin " + source.getGroupId() + ":" + source.getArtifactId() + " not found");
        }
        return status;
    }