CaptainAni187 opened a new pull request, #1236:
URL: https://github.com/apache/maven-plugin-tools/pull/1236

   Fixes #1229.
   
   The factory generated for a Maven 4 API mojo always called the mojo's no-arg 
constructor, so a mojo using constructor injection built fine and then failed 
with `NoSuchMethodError` when the goal ran.
   
   The factory constructor now mirrors the constructor DI would use on the 
mojo: the `@Inject` one, otherwise the no-arg one, otherwise the only one. It 
keeps the generic signature and the constructor and parameter annotations, so 
qualifiers like `@Named` still apply, and passes the arguments to `super(...)`. 
A mojo with a no-arg constructor and no `@Inject` constructor gets the same 
factory as before. If no constructor can be picked (several without `@Inject`, 
or more than one with it), the `descriptor` goal fails with a message instead 
of producing a plugin that breaks at run time.
   
   The new tests build the mojo classes with ASM, so the Maven 4 API isn't 
needed on the test classpath. I also ran the reproducer from the issue on Maven 
4.0.0-rc-7: it fails with 4.0.0-beta-3 and runs with this 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]

Reply via email to