[MNG-8572] Support DI beans in build extensions#2274
Merged
Conversation
e4f688f to
ea0e902
Compare
ea0e902 to
f84c8c4
Compare
This commit adds support for using the Maven API DI system in build extensions (plugins with extensions=true). It enables build extensions to provide custom artifact type handlers using the new DI mechanism. Key changes: - Added an integration test that demonstrates a custom artifact type handler using the Maven API DI system in a build extension - The test shows how to implement a TypeProvider using @nAmed annotation - The annotation processor automatically generates the DI index file - The custom type handler is properly discovered and used during the build This enhancement allows build extensions to leverage the new Maven API DI system, making it easier to create and maintain extensions that provide custom artifact type handlers.
f84c8c4 to
a79fdd3
Compare
cstamas
reviewed
May 13, 2025
| .flatMap(p -> p.provides().stream()) | ||
| .collect(Collectors.toMap(Type::id, identity())); | ||
| public DefaultTypeRegistry(Lookup lookup, LanguageRegistry languageRegistry, LegacyArtifactHandlerManager manager) { | ||
| this.lookup = lookup; |
Contributor
Author
There was a problem hiding this comment.
AFAIK, nullable must be opt-in for injection, so no annotation here means the dependencies are required.
Member
There was a problem hiding this comment.
I was more about requireNonNull ... As other ctor params
cstamas
approved these changes
May 13, 2025
gnodet
commented
May 13, 2025
impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultTypeRegistry.java
Outdated
Show resolved
Hide resolved
…efaultTypeRegistry.java
Pankraz76
pushed a commit
to Pankraz76/maven
that referenced
this pull request
May 14, 2025
This commit adds support for using the Maven API DI system in build extensions (plugins with extensions=true). It enables build extensions to provide custom artifact type handlers using the new DI mechanism. Key changes: - Added an integration test that demonstrates a custom artifact type handler using the Maven API DI system in a build extension - The test shows how to implement a TypeProvider using @nAmed annotation - The annotation processor automatically generates the DI index file - The custom type handler is properly discovered and used during the build This enhancement allows build extensions to leverage the new Maven API DI system, making it easier to create and maintain extensions that provide custom artifact type handlers.
|
Resolve #9369 |
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.
This PR adds support for using the Maven API DI system in build extensions (plugins with extensions=true). It enables build extensions to provide custom artifact type handlers using the new DI mechanism.
Key changes
@NamedannotationThis enhancement allows build extensions to leverage the new Maven API DI system, making it easier to create and maintain extensions that provide custom artifact type handlers.
Fixes: https://issues.apache.org/jira/browse/MNG-8572