arturobernalg opened a new pull request, #13504:
URL: https://github.com/apache/maven/pull/13504

   Backport of #13497 to `maven-4.0.x`. Fixes #8052
   
   ### What and why
   
   `PluginParameterExpressionEvaluator(MavenSession)` creates the evaluator 
without a `MojoExecution`, but `evaluate()` called 
`mojoExecution.getMojoDescriptor()` for every expression. Any `${...}` 
therefore failed with a `NullPointerException`, as reported in the issue by a 
tool that uses the evaluator outside a mojo execution.
   
   ### How
   
   The mojo descriptor is only read when there is a mojo execution. The 
`mojo.*` and `plugin.*` expressions need one and have no value without it, so 
they evaluate to nothing, like any unknown expression, and fall back to the 
properties lookup. All other expressions are evaluated as before. The change is 
the same as on master.
   
   ### Tests
   
   `PluginParameterExpressionEvaluatorTest` has two new tests that use the 
single argument constructor. Both fail on `maven-4.0.x` with the 
`NullPointerException` of the issue and pass with the change, three runs in a 
row. The test class passes (28 tests) and spotless is clean. I did not run the 
integration tests.
   
   ---
   
   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:
   
   - [ ] 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]

Reply via email to