apache/maven · error · ComponentConfigurationException

Error evaluating the expression '${expression}' for configur

Error message

Error evaluating the expression '${expression}' for configuration value '${configuration.getName()}'

What it means

While validating parameters for a non-basic configurator, Maven tried to evaluate a ${...} expression in the parameter configuration and the expression evaluator threw ExpressionEvaluationException — the expression could not be evaluated at all (unparseable or references an object path that does not exist), as opposed to evaluating to null. It is wrapped as ComponentConfigurationException naming both the expression and the configuration element, then aggregated into the goal's PluginParameterException.

Source

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

                continue;
            }

            Object value = null;

            PlexusConfiguration config = configuration.getChild(parameter.getName(), false);
            if (config != null) {
                String expression = config.getValue(null);

                try {
                    value = expressionEvaluator.evaluate(expression);

                    if (value == null) {
                        value = config.getAttribute("default-value", null);
                    }
                } catch (ExpressionEvaluationException e) {
                    String msg = "Error evaluating the expression '" + expression + "' for configuration value '"
                            + configuration.getName() + "'";
                    throw new ComponentConfigurationException(configuration, msg, e);
                }
            }

            if (value == null && (config == null || config.getChildCount() <= 0)) {
                invalidParameters.add(parameter);
            }
        }

        if (!invalidParameters.isEmpty()) {
            throw new PluginParameterException(mojoDescriptor, invalidParameters);
        }
    }

    @Override
    public void releaseMojo(Object mojo, MojoExecution mojoExecution) {
        if (mojo != null) {
            try {
                container.release(mojo);

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Correct the expression named in the message — usually a typo in a property or object path.
  2. Define the property in <properties> (or the right profile) and re-run.
  3. Pre-test any expression with mvn help:evaluate -Dexpression=<expr> -DforceStdout before wiring it into configuration.
  4. Use the default-value attribute in plugin.xml (for plugin authors) so absent values fall back instead of failing.
  5. Check mvn help:effective-pom to see the raw expression as Maven received it.

Example fix

// before: typo in the expression, evaluation fails
<outputDirectory>${project.build.diretory}/extra</outputDirectory>

// after: correct expression
<outputDirectory>${project.build.directory}/extra</outputDirectory>
Defensive patterns

Strategy: validation

Validate before calling

# pre-test every expression you plan to embed in plugin configuration
for expr in project.build.directory project.version some.custom.property; do
  echo "$expr -> $(mvn -q help:evaluate -Dexpression=$expr -DforceStdout 2>/dev/null || echo '<EVALUATION FAILED>')"
done

Try / catch

// embedder: when validating parameters yourself, catch and name the failing expression
try {
    configurator.configureComponent(mojo, configuration, evaluator, realm, validator);
} catch (ComponentConfigurationException e) {
    if (e.getCause() instanceof ExpressionEvaluationException eee) {
        log.error('expression failed: {}', eee.getMessage());
    }
    throw e;
}

Prevention

When it happens

Trigger: A typo inside ${...} (e.g. ${project.build.diretory}); an expression referencing a property or object path that is not defined in this session/POM; expression syntax the evaluator cannot parse; value read via config.getValue(null) being a malformed expression.

Common situations: Renamed/misspelled properties; properties defined in an inactive profile or supplied only by CI on another job; expressions valid in a newer Maven version used on an older one; interpolated values inherited from a parent POM that drift.

Related errors


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