-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[MNG-7947] Plugin API #1309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MNG-7947] Plugin API #1309
Conversation
|
@mcculls please chime in |
elharo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with these specific annotations. However I've noticed in some cases only the simple name of the annotation matters, not the package. If that applies here, you could define Maven specific annotations with the right name rather than depending on Guice.
Yeah, that's true for some annotations, unfortunately, guice is very specific about which ones are used, so it does not work here, see https://github.com/google/guice/blob/6.0.0/core/src/com/google/inject/internal/Annotations.java#L350 |
|
Resolve #8724 |
Switch to Guice 6.0, use guice to instantiate and inject mojos
Context: my goal for the maven API was to be completely independent of any third party library. I was working this week on migrating some parts of the Plugin API for Maven 4. Unfortunately, the scopes (
@SessionScopedand@MojoExecutionScoped) need to be annotated by a scope annotation so that they are recognised as such by Guice. So either the guice annotation or the javax.inject one. Givenjavax.injectwill slowly go away, I went straight tojakarta.inject, thus upgrading to Guice 6.0 (which supports bothjavax.injectandjakarta.inject, while Guice 7.0 only supportsjakarta.inject).Maven 4 api for plugin execution
This introduces an immutable plugin descriptor (and custom lifecycle for plugins too). The Maven 3
PluginDescriptorcontains runtime information such as the class loader, dependencies, etc... Those are moved to theo.a.m.api.Pluginclass which can be accessed from theo.a.m.api.MojoExecutionalong with theMojoDescriptorandPluginDescriptor.Leveraging guice, some fields inherited from the plexus land now disappear:
instantiationStrategyis replaced with scope annotations,@Componentreplaced by@Inject.