{"record":{"id":"1b53b878c56ce6b5","repo":"apache/maven","slug":"error-evaluating-plugin-parameter-expression-ex","errorCode":null,"errorMessage":"Error evaluating plugin parameter expression: ${expression}","messagePattern":"Error evaluating plugin parameter expression: (.+?)","errorType":"exception","errorClass":"ExpressionEvaluationException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java","lineNumber":191,"sourceCode":"            try {\n                int pathSeparator = expression.indexOf('/');\n\n                if (pathSeparator > 0) {\n                    String pathExpression = expression.substring(0, pathSeparator);\n                    value = ReflectionValueExtractor.evaluate(pathExpression, session);\n                    if (pathSeparator < expression.length() - 1) {\n                        if (value instanceof Path path) {\n                            value = path.resolve(expression.substring(pathSeparator + 1));\n                        } else {\n                            value = value + expression.substring(pathSeparator);\n                        }\n                    }\n                } else {\n                    value = ReflectionValueExtractor.evaluate(expression, session);\n                }\n            } catch (Exception e) {\n                // TODO don't catch exception\n                throw new ExpressionEvaluationException(\n                        \"Error evaluating plugin parameter expression: \" + expression, e);\n            }\n        } else if (\"reactorProjects\".equals(expression)) {\n            value = session.getProjects();\n        } else if (\"project\".equals(expression)) {\n            value = project;\n        } else if (\"executedProject\".equals(expression)) {\n            value = project.getExecutionProject();\n        } else if (expression.startsWith(\"project\") || expression.startsWith(\"pom\")) {\n            try {\n                int pathSeparator = expression.indexOf('/');\n\n                if (pathSeparator > 0) {\n                    String pathExpression = expression.substring(0, pathSeparator);\n                    value = ReflectionValueExtractor.evaluate(pathExpression, project);\n                    value = value + expression.substring(pathSeparator);\n                } else {\n                    value = ReflectionValueExtractor.evaluate(expression, project);","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java#L173-L209","documentation":"While injecting configuration into a mojo, Maven evaluated a plugin parameter expression rooted at the session object (for example ${session.localRepository.path}) via ReflectionValueExtractor, and the reflective walk threw. Maven wraps the failure in ExpressionEvaluationException carrying the exact expression, which then surfaces as a mojo configuration failure.","triggerScenarios":"An expression like ${session.someField} where someField is not a readable property of MavenSession; a nested path that traverses a null intermediate (a getter returns null and the next segment is dereferenced); malformed path segments with stray characters.","commonSituations":"Typos in POM configuration values; expressions that worked under an older Maven where session getters differed; templates copied from other projects that reference session state which is null in the current phase.","solutions":["Test the expression standalone: mvn help:evaluate -Dexpression=session.localRepository.path -q -DforceStdout.","Compare the path against the MavenSession getters (getLocalRepository, getSettings, getTopLevelProject, ...) and fix the segment names.","If an intermediate value can be null, split the expression or provide a default through a property in <properties>.","Prefer plain project properties over deep session reflection paths."],"exampleFix":"<!-- before -->\n<repoDir>${session.localRepo.path}</repoDir>\n<!-- after: match the real MavenSession getter chain -->\n<repoDir>${session.localRepository.path}</repoDir>","handlingStrategy":"validation","validationCode":"mvn -q org.apache.maven.plugins:maven-help-plugin:3.4.1:evaluate \\\n  -Dexpression=session.localRepository.path -DforceStdout || echo 'BAD EXPRESSION'","typeGuard":null,"tryCatchPattern":"try {\n    configValue = evaluator.evaluate(expr, Object.class);\n} catch (ExpressionEvaluationException e) {\n    throw new MojoExecutionException(\"unresolvable expression: \" + e.getMessage(), e);\n}","preventionTips":["Lint plugin configurations for session.* expressions against MavenSession getters","Verify expressions with help:evaluate during POM review","Avoid deep nested paths; bind intermediate values into <properties>"],"tags":["maven","expression","session","plugin-configuration","reflection"],"backgroundTag":"maven-expression-evaluation-failed","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}