apache/maven · error · MisconfiguredToolchainException

Provides token '" + key + "' doesn't have any value configur

Error message

Provides token '" + key + "' doesn't have any value configured.

What it means

JavaToolchainFactory iterates the <provides> section of a jdk toolchain in toolchains.xml and requires every token to have a value. When a provides entry has a null value (element present but no content mapped to a value), MisconfiguredToolchainException("Provides token '<key>' doesn't have any value configured.") aborts toolchain creation. The token named in the message is the one to fix.

Source

Thrown at compat/maven-compat/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java:70

    @Override
    public ToolchainPrivate createToolchain(ToolchainModel model) throws MisconfiguredToolchainException {
        if (model == null) {
            return null;
        }

        // use DefaultJavaToolChain for compatibility with maven 3.2.3 and earlier

        @SuppressWarnings("deprecation")
        JavaToolchainImpl jtc = new DefaultJavaToolChain(model, logger);

        // populate the provides section
        Properties provides = model.getProvides();
        for (Entry<Object, Object> provide : provides.entrySet()) {
            String key = (String) provide.getKey();
            String value = (String) provide.getValue();

            if (value == null) {
                throw new MisconfiguredToolchainException(
                        "Provides token '" + key + "' doesn't have any value configured.");
            }

            RequirementMatcher matcher;
            if ("version".equals(key)) {
                matcher = RequirementMatcherFactory.createVersionMatcher(value);
            } else {
                matcher = RequirementMatcherFactory.createExactMatcher(value);
            }

            jtc.addProvideToken(key, matcher);
        }

        // populate the configuration section
        Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
        Xpp3Dom javahome = dom != null ? dom.getChild(JavaToolchainImpl.KEY_JAVAHOME) : null;
        if (javahome == null) {
            throw new MisconfiguredToolchainException(

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Open toolchains.xml, find the <provides> token named in the message, and give it a value (e.g. <version>17</version>, <vendor>temurin</vendor>)
  2. Remove the token entirely if it is not needed for matching
  3. Keep values consistent with what projects request via maven-toolchains-plugin <requires> so matching still succeeds afterwards

Example fix

<!-- before -->
<provides>
  <version>17</version>
  <vendor/>
</provides>

<!-- after -->
<provides>
  <version>17</version>
  <vendor>temurin</vendor>
</provides>
Defensive patterns

Strategy: validation

Validate before calling

import org.apache.maven.toolchain.model.ToolchainModel;
import java.util.Properties;

void assertProvidesAllValued(ToolchainModel model) {
    Properties provides = model.getProvides();
    for (Entry<Object, Object> e : provides.entrySet()) {
        if (e.getValue() == null) {
            throw new IllegalStateException(
                "Provides token '" + e.getKey() + "' has no value — fix toolchains.xml");
        }
    }
}

Try / catch

try {
    ToolchainPrivate toolchain = toolchainFactory.createToolchain(model, log);
} catch (MisconfiguredToolchainException e) {
    if (e.getMessage().contains("doesn't have any value configured")) {
        reportToolchainsXmlError(e.getMessage()); // message names the exact token to fix
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: A toolchains.xml jdk toolchain containing a <provides> entry whose element has no value — e.g. <provides><vendor/></provides> — parsed into a Properties entry with null value and rejected by the factory.

Common situations: Copy-pasted toolchain templates with placeholder tokens never filled in; scripts generating toolchains.xml omitting the value for one token; commented-out values accidentally leaving empty elements behind.

Related errors


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