Skip to content

Conversation

gnodet
Copy link
Contributor

@gnodet gnodet commented Sep 17, 2025

Backport

This will backport the following commits from master to maven-4.0.x:

Fixes #11055

Questions ?

Please refer to the Backport tool documentation

@gnodet gnodet changed the title [maven-4.0.x] GH-11055: Inject all services into mojos and enable easy real-session mojo testing (#11103) [maven-4.0.x] #11055: Inject all services into mojos and enable easy real-session mojo testing (#11103) Sep 17, 2025
…ession mojo testing (apache#11103)

Highlights
- All services are injectable into mojos
  - Add InternalSession#getAllServices() to expose all DI service suppliers for the session (Map<Class<? extends Service>, Supplier<? extends Service>>)
  - Add Injector#bindSupplier(Class<T>, Supplier<T>) to bind a type directly to a Supplier
  - Adjust DI bootstrap/bindings (Injector/Binding/InjectorImpl, SisuDiBridgeModule) and touch minor call sites to respect the wiring
- Mojos can be easily tested with a real session
  - @MojoTest(realSession=true) supported by MojoExtension; creates a real InternalSession via ApiRunner, otherwise uses SessionMock
  - New MojoRealSessionTest covers default/custom mock vs real-session paths

Details
- SessionScope alignment: when @typed is empty, include only the class’s direct interfaces (not super-interfaces)
- Testing support: SecDispatcherProvider for encrypted password handling without Sonatype dispatcher; expanded MojoTest for evaluator coverage
- IT: add apachegh-11055-di-service-injection verifying DI service injection end-to-end with pre-populated resources under its/core-it-suite; integrated into TestSuiteOrdering

(cherry picked from commit 6b7c9f2)
@gnodet gnodet force-pushed the backport/maven-4.0.x/pr-11103 branch from e2b9423 to 5d85014 Compare September 18, 2025 16:57
@gnodet gnodet added backport bug Something isn't working mvn40 labels Sep 19, 2025
@gnodet gnodet merged commit acd6689 into apache:maven-4.0.x Sep 22, 2025
39 of 41 checks passed
@github-actions github-actions bot added this to the 4.0.0 milestone Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport bug Something isn't working mvn40
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant