{"record":{"id":"e8215d728aa6e056","repo":"apache/maven","slug":"cannot-evaluate-expression-s-for-configuration","errorCode":null,"errorMessage":"Cannot evaluate expression '%s' for configuration entry '%s'","messagePattern":"Cannot evaluate expression '(.+?)' for configuration entry '(.+?)'","errorType":"exception","errorClass":"ComponentConfigurationException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/configuration/internal/EnhancedConfigurationConverter.java","lineNumber":74,"sourceCode":"                }\n            }\n            if (null == result && configuration.getChildCount() == 0) {\n                value = configuration.getAttribute(\"default-value\");\n                if (null != value && !value.isEmpty()) {\n                    if (evaluator instanceof TypeAwareExpressionEvaluator typeAwareExpressionEvaluator) {\n                        result = typeAwareExpressionEvaluator.evaluate(value, type);\n                    } else {\n                        result = evaluator.evaluate(value);\n                    }\n                }\n            }\n            failIfNotTypeCompatible(result, type, configuration);\n            return result;\n        } catch (final ExpressionEvaluationException e) {\n            final String reason = String.format(\n                    \"Cannot evaluate expression '%s' for configuration entry '%s'\", value, configuration.getName());\n\n            throw new ComponentConfigurationException(configuration, reason, e);\n        }\n    }\n\n    @Override\n    public Object fromConfiguration(\n            final ConverterLookup lookup,\n            final PlexusConfiguration configuration,\n            final Class<?> type,\n            final Class<?> enclosingType,\n            final ClassLoader loader,\n            final ExpressionEvaluator evaluator,\n            final ConfigurationListener listener)\n            throws ComponentConfigurationException {\n        final Object value = fromExpression(configuration, evaluator, type);\n        if (type.isInstance(value)) {\n            return value;\n        }\n        try {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/configuration/internal/EnhancedConfigurationConverter.java#L56-L92","documentation":"Maven failed to interpolate a ${...} expression while configuring a plugin or component. EnhancedConfigurationConverter.fromExpression() delegates the raw string to the ExpressionEvaluator (normally PluginParameterExpressionEvaluator); any ExpressionEvaluationException is wrapped as a ComponentConfigurationException naming the offending expression and the configuration entry. An expression that resolves to null is silently accepted; only evaluation errors raise this.","triggerScenarios":"Any mojo configuration value (or default-value attribute) containing ${...} that the evaluator cannot resolve: an undefined property, an expression backed by a missing object, or malformed interpolation detected by the evaluator such as unbalanced '${'.","commonSituations":"Property defined only in a profile that is inactive in CI; ${env.VAR} missing in the build environment; typo'd property name; properties expected from an earlier plugin execution that did not run; migrating builds between environments with different settings.xml.","solutions":["Run mvn -X to see the wrapped cause and identify which expression fails","Define the property: add it to the pom <properties>, pass -Dkey=value, or put it in an active settings.xml profile","If the value may legitimately be absent, guard by defining a default value for the property in the pom used as interpolation fallback","Fail fast instead: add maven-enforcer requireProperty rules in the validate phase so missing properties are reported with clear messages"],"exampleFix":"<!-- before: property may be undefined at evaluation time -->\n<configuration>\n  <token>${api.token}</token>\n</configuration>\n\n<!-- after: give the property a default in the pom -->\n<properties>\n  <api.token>local-dev-token</api.token>\n</properties>","handlingStrategy":"validation","validationCode":"// Before running the build, assert every ${...} referenced in plugin config is defined\nSet<String> defined = new HashSet<>();\nrequest.getUserProperties().stringPropertyNames().forEach(defined::add);\nrequest.getSystemProperties().stringPropertyNames().forEach(defined::add);\nproject.getModel().getProperties().stringPropertyNames().forEach(defined::add);\nMatcher m = Pattern.compile(\"\\\\$\\\\{([^}]+)}\").matcher(configXml);\nwhile (m.find()) {\n    String key = m.group(1);\n    if (!key.startsWith(\"project.\") && !key.startsWith(\"env.\") && !defined.contains(key)) {\n        throw new IllegalStateException(\"Undefined property referenced in plugin config: \" + key);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    mojo.execute();\n} catch (ComponentConfigurationException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Cannot evaluate expression\")) {\n        // interpolation failure: report which expression and fix the property, do not retry blindly\n        log.error(\"Missing property for {}: {}\", e.getMessage(), e.getCause().getMessage());\n    }\n}","preventionTips":["Define all interpolated properties in the pom with safe defaults","Use maven-enforcer requireProperty for environment-dependent properties so failures are explicit at validate time","Avoid interpolating properties that only exist on developer machines in shared build configs"],"tags":["maven","interpolation","plugin-configuration","properties","expression-evaluation"],"backgroundTag":"unresolved-property-interpolation","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}