This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch plume-football
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/plume-football by this push:
new c14811794b [MNG-11642] Fix DI annotation processor and nullable
collection handling
c14811794b is described below
commit c14811794bad02e8e627ffca5373ac90bbeeb2f4
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed May 20 16:04:04 2026 +0200
[MNG-11642] Fix DI annotation processor and nullable collection handling
Configure annotationProcessorPaths for maven-impl, maven-di, and
maven-jline to ensure the DiIndexProcessor runs during modular
compilation and generates META-INF/maven/org.apache.maven.api.di.Inject.
Default @Nullable collection parameters to empty collections in
DefaultModelProcessor and DefaultModelBuilder to prevent NPE when
no implementations are available.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
impl/maven-di/pom.xml | 18 ++++++++++++++++++
impl/maven-impl/pom.xml | 13 +++++++++++++
.../apache/maven/impl/model/DefaultModelBuilder.java | 2 +-
.../apache/maven/impl/model/DefaultModelProcessor.java | 2 +-
impl/maven-jline/pom.xml | 18 ++++++++++++++++++
5 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/impl/maven-di/pom.xml b/impl/maven-di/pom.xml
index 759bc07b27..2689bd2ab7 100644
--- a/impl/maven-di/pom.xml
+++ b/impl/maven-di/pom.xml
@@ -51,4 +51,22 @@ under the License.
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-api-di</artifactId>
+ <version>${project.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/impl/maven-impl/pom.xml b/impl/maven-impl/pom.xml
index c67e09a47f..ec3ab2d79f 100644
--- a/impl/maven-impl/pom.xml
+++ b/impl/maven-impl/pom.xml
@@ -175,6 +175,19 @@ under the License.
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-api-di</artifactId>
+ <version>${project.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
diff --git
a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
index 60a49fcc2e..1022bd57b6 100644
---
a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
+++
b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
@@ -201,7 +201,7 @@ public DefaultModelBuilder(
this.dependencyManagementImporter = dependencyManagementImporter;
this.pluginConfigurationExpander = pluginConfigurationExpander;
this.versionParser = versionParser;
- this.transformers = transformers;
+ this.transformers = transformers != null ? transformers : List.of();
this.modelResolver = modelResolver;
this.interpolator = interpolator;
this.pathTranslator = pathTranslator;
diff --git
a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelProcessor.java
b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelProcessor.java
index 49ce1c96e6..c2f37654ad 100644
---
a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelProcessor.java
+++
b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelProcessor.java
@@ -74,7 +74,7 @@ public class DefaultModelProcessor implements ModelProcessor {
@Inject
public DefaultModelProcessor(ModelXmlFactory modelXmlFactory, @Nullable
Map<String, ModelParser> modelParsers) {
this.modelXmlFactory = modelXmlFactory;
- this.modelParsers = modelParsers;
+ this.modelParsers = modelParsers != null ? modelParsers : Map.of();
}
@Override
diff --git a/impl/maven-jline/pom.xml b/impl/maven-jline/pom.xml
index 197905ba11..9d40ba473a 100644
--- a/impl/maven-jline/pom.xml
+++ b/impl/maven-jline/pom.xml
@@ -85,4 +85,22 @@ under the License.
<artifactId>jansi-core</artifactId>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-api-di</artifactId>
+ <version>${project.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>