[maven-4.0.x] #11055: Inject all services into mojos and enable easy real-session mojo testing (#11103)#11139
Merged
gnodet merged 1 commit intoapache:maven-4.0.xfrom Sep 22, 2025
Conversation
…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)
e2b9423 to
5d85014
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mastertomaven-4.0.x:Fixes #11055
Questions ?
Please refer to the Backport tool documentation