Conversation
|
@mcculls please chime in |
elharo
left a comment
There was a problem hiding this comment.
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.