sharanggupta opened a new pull request, #13498:
URL: https://github.com/apache/maven/pull/13498
Fixes #8052 (MNG-6982).
`PluginParameterExpressionEvaluator` has a constructor taking only a
`MavenSession`, but `evaluate()` starts with
`mojoExecution.getMojoDescriptor()` for every `${...}` expression, so an
evaluator created that way fails with a `NullPointerException` even for
`${project}`, `${session}` or `${basedir}`.
The mojo descriptor is now looked up only when there is a mojo execution,
and `${plugin}` / `${plugin.*}` evaluate to `null` without one, which is what
`${mojo.*}` already did (`ReflectionValueExtractor.evaluate()` returns `null`
for a `null` root) and what unknown expressions do, so the usual fallback to
the properties still applies. The session-only constructor documents this.
`PluginParameterExpressionEvaluatorTest.testEvaluationWithoutMojoExecution`
covers `${session}`, `${project}`, a literal, and the mojo and plugin
expressions; it fails on `master` with the `NullPointerException` at the first
`evaluate()`.
The same code is in `maven-core` on `maven-3.10.x` (the issue was reported
against 3.6.3); a backport would be welcome if you agree with the change.
---
To make clear that you license your contribution under
the [Apache License Version 2.0, January
2004](https://www.apache.org/licenses/LICENSE-2.0)
check one of the following:
- [x] I hereby declare this contribution to be licensed under the [Apache
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
- [ ] I hereby declare that I have filed an [Apache Individual Contributor
License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]