gnodet opened a new pull request, #14116: URL: https://github.com/apache/maven/pull/14116
## Summary Deprecates `org.apache.maven.api.di.MojoExecutionScoped` on the `maven-4.0.x` branch as proposed in #13839. ## Why it is deprecated 1. **Guice/Sisu binding is commented out.** `MojoExecutionScopeModule.configure()` has the v4 annotation binding explicitly commented out — the annotation has no runtime effect. 2. **No proxy path.** Unlike `@SessionScoped`, the mojo execution scope has no `createProxy()` path. Injecting a `@MojoExecutionScoped` component into a wider scope (e.g. `@Singleton`) throws `DIException` at startup. 3. **v4 plugins don't need it.** `DefaultMavenPluginManager` creates a fresh injector per mojo execution and binds `Session`, `Project`, `MojoExecution`, and `Log` directly via `bindInstance`. Plain `@Inject` is sufficient. ## Fix Added `@Deprecated` to `MojoExecutionScoped` with a Javadoc note explaining: - Why it should not be used (unfinished, no proxy, no Guice binding) - What to use instead (plain `@Inject` for v4 plugins; `org.apache.maven.execution.scope.MojoExecutionScoped` for legacy Plexus/Sisu extension components) ## Tests No test change needed — this is a pure API deprecation with no behaviour change. Fixes #13839 --- _Hermes Agent (Claude Sonnet 4.5) on behalf of Guillaume Nodet_ -- 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]
