{"record":{"id":"a9bab59125ff865a","repo":"apache/maven","slug":"unable-to-convert-configuration-to-xml-node","errorCode":null,"errorMessage":"Unable to convert configuration to xml node","messagePattern":"Unable to convert configuration to xml node","errorType":"exception","errorClass":"ComponentConfigurationException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/configuration/internal/DefaultBeanConfigurator.java","lineNumber":163,"sourceCode":"        public boolean canConvert(Class<?> type) {\n            return XmlNode.class.equals(type);\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\n            try {\n                return toXml(configuration, evaluator);\n            } catch (ExpressionEvaluationException e) {\n                throw new ComponentConfigurationException(\"Unable to convert configuration to xml node\", e);\n            }\n        }\n\n        XmlNode toXml(PlexusConfiguration config, ExpressionEvaluator evaluator) throws ExpressionEvaluationException {\n            List<XmlNode> children = new ArrayList<>();\n            for (PlexusConfiguration c : config.getChildren()) {\n                children.add(toXml(c, evaluator));\n            }\n            String name = config.getName();\n            Object value = evaluator.evaluate(config.getValue());\n            return XmlNode.newInstance(name, value != null ? value.toString() : null, null, children, null);\n        }\n    }\n\n    static class PathConverter extends AbstractBasicConverter {\n        @Override\n        public boolean canConvert(Class<?> type) {\n            return Path.class.equals(type);","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/configuration/internal/DefaultBeanConfigurator.java#L145-L181","documentation":"When a mojo/component parameter is typed org.apache.maven.api.xml.XmlNode, DefaultBeanConfigurator's XmlConverter converts the Plexus configuration subtree to an XML node, evaluating every text value through the expression evaluator first; if evaluation throws ExpressionEvaluationException (in Maven this wraps a BeanConfigurationException from the value preprocessor), the binding fails with ComponentConfigurationException 'Unable to convert configuration to xml node'. The culprit is interpolation inside that XML-valued parameter.","triggerScenarios":"A plugin configuration block bound to an XmlNode parameter whose text contains ${...} that the preprocessor fails on - e.g. expressions referencing objects unavailable at configuration time, or nested/malformed expression syntax the evaluator rejects.","commonSituations":"Plugins with XML-blob parameters (inline rule/config fragments) embedding property placeholders; upgrades changing which expressions the evaluator accepts; builds where a property referenced in XML config is consumed before the context providing it exists.","solutions":["Locate the ${...} token inside the failing plugin's XML-valued parameter and fix or remove it.","Pass dynamic values through simple string parameters and reference them, keeping literal XML static.","Check plugin version compatibility - older plugins may use expressions the current evaluator refuses.","If the expression is intentional, verify the referenced property/object exists at configuration time (set it via -D, settings, or profile)."],"exampleFix":"<!-- before: expression inside an XmlNode-valued parameter the evaluator cannot resolve -->\n<config>\n  <ruleset>${build.ruleset.dir}/rules.xml</ruleset>\n</config>\n\n<!-- after: literal value (or bind via a plain String parameter) -->\n<config>\n  <ruleset>src/main/resources/rules.xml</ruleset>\n</config>","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    configurator.configureBean(request); // XmlConverter failures surface here\n} catch (BeanConfigurationException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Unable to convert configuration to xml node\")) {\n        reportBadExpressionInParameter(request, e); // point at the ${...} inside the XML param\n    } else {\n        throw e;\n    }\n}","preventionTips":["Keep ${...} out of XmlNode-valued parameters; move dynamic values to plain string parameters.","Test plugin configurations with all profiles active so every expression resolves.","After Maven/plugin upgrades, grep plugin XML blobs for interpolation tokens."],"tags":["maven","plugin-configuration","interpolation","xml"],"backgroundTag":"plugin-configuration-interpolation-failed","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}