apache/maven · warning

Could not verify plugin's Maven prerequisite as an invalid v

Error message

Could not verify plugin's Maven prerequisite as an invalid version is given in {}

What it means

MavenPluginMavenPrerequisiteChecker.accept() validates a plugin descriptor's requiredMavenVersion (from the plugin's <prerequisites><maven> in plugin.xml) by calling RuntimeInformation.isMavenVersion(requiredMavenVersion), which parses the string as a version/version range. If the value is malformed the parser throws IllegalArgumentException; Maven logs this warning (with the offending string concatenated into the message) and silently skips the prerequisite check - the plugin is accepted without verification. Contrast the non-parseable case with the 'Required Maven version X is not met' IllegalStateException when a valid version simply is not satisfied.

Source

Thrown at impl/maven-core/src/main/java/org/apache/maven/plugin/internal/MavenPluginMavenPrerequisiteChecker.java:55

    @Inject
    public MavenPluginMavenPrerequisiteChecker(RuntimeInformation runtimeInformation) {
        super();
        this.runtimeInformation = runtimeInformation;
    }

    @Override
    public void accept(PluginDescriptor pluginDescriptor) {
        String requiredMavenVersion = pluginDescriptor.getRequiredMavenVersion();

        boolean isBlankVersion =
                requiredMavenVersion == null || requiredMavenVersion.trim().isEmpty();

        if (!isBlankVersion) {
            boolean isRequirementMet = false;
            try {
                isRequirementMet = runtimeInformation.isMavenVersion(requiredMavenVersion);
            } catch (IllegalArgumentException e) {
                logger.warn(
                        "Could not verify plugin's Maven prerequisite as an invalid version is given in "
                                + requiredMavenVersion,
                        e);
                return;
            }
            if (!isRequirementMet) {
                throw new IllegalStateException("Required Maven version " + requiredMavenVersion
                        + " is not met by current version " + runtimeInformation.getMavenVersion());
            }
        }
    }
}

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Fix the plugin POM's <prerequisites><maven> to a plain literal version (e.g. 3.6.3) and rebuild/release the plugin
  2. Upgrade to a released version of the third-party plugin where the prerequisite is corrected
  3. Until fixed, remember the check is skipped (warning only): verify manually that the plugin behaves on your Maven, since Maven will not enforce compatibility for it

Example fix

<!-- before: unparseable value ends up in plugin.xml -->
<prerequisites>
  <maven>${maven.min.version}</maven>
</prerequisites>
<!-- after -->
<prerequisites>
  <maven>3.6.3</maven>
</prerequisites>
Defensive patterns

Strategy: validation

Validate before calling

// plugin build check: fail if the prerequisite does not parse
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.VersionRange;

void checkPrerequisite(String v) throws InvalidVersionSpecificationException {
    if (v != null && !v.trim().isEmpty()) VersionRange.createFromVersionSpec(v);
}

Type guard

// returns true when the descriptor prerequisite can be parsed
static boolean isParseablePrerequisite(String v) {
    if (v == null || v.trim().isEmpty()) return true;
    try {
        org.apache.maven.artifact.versioning.VersionRange.createFromVersionSpec(v);
        return true;
    } catch (org.apache.maven.artifact.versioning.InvalidVersionSpecificationException e) {
        return false;
    }
}

Prevention

When it happens

Trigger: Loading a plugin whose descriptor carries an unparseable prerequisite string - e.g. '[3.0,', '3.9.x-SNAP', 'JDK1.8' or an unresolved property like ${maven.version} baked into plugin.xml. Reached via direct plugin invocation, prefix resolution (DefaultPluginPrefixResolver), or candidate checks during plugin version search.

Common situations: Hand-edited plugin POMs with typos in <prerequisites>; old plugin parent POMs writing filtered property placeholders into the descriptor; custom in-house plugins where nobody noticed the prerequisite was never checked.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/d64e19a9f5a6b924. Report an issue: GitHub.