This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new 40b7f5a6d4 feat: improve XSD generation for MDO files using 
xsd.enumerations/xsd.suggestions
40b7f5a6d4 is described below

commit 40b7f5a6d44c5e511db5973148c0653f42f4c83c
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Nov 13 07:56:30 2026 +0100

    feat: improve XSD generation for MDO files using 
xsd.enumerations/xsd.suggestions
    
    feat: improve XSD generation for MDO files using 
xsd.enumerations/xsd.suggestions
    
    Leverage codehaus-plexus/modello#634 (xs:enumeration restrictions support in
    XSD generation via field metadata) to annotate well-known constrained fields
    in the Maven MDO models. The modello-maven-plugin is at 2.9.0 (released),
    referenced via the ${modelloVersion} property in the root pom.xml.
    
    Changes in api/maven-api-model/src/main/mdo/maven.mdo:
    - Dependency.scope: xsd.suggestions (non-strict) - extensible via 
DependencyScope
    - Dependency.type: xsd.suggestions (non-strict) - plugins can define new 
types
    - Model.packaging: xsd.suggestions (non-strict) - plugins can define new 
packaging
    - PluginExecution.phase: xsd.suggestions (non-strict) - custom phases 
possible
    - RepositoryBase.layout: xsd.suggestions (non-strict) - default/legacy
    - RepositoryPolicy.checksumPolicy: xsd.enumerations (strict) - 
fail/warn/ignore
    - RepositoryPolicy.updatePolicy: xsd.suggestions (non-strict) - 
interval:NNN is open-ended
    
    Changes in api/maven-api-settings/src/main/mdo/settings.mdo:
    - Proxy.protocol: xsd.suggestions - http/https
    - Mirror.layout / Repository.layout: xsd.suggestions - default/legacy
    - RepositoryPolicy.checksumPolicy: xsd.enumerations (strict) - 
fail/warn/ignore
    - RepositoryPolicy.updatePolicy: xsd.suggestions (non-strict) - 
interval:NNN is open
    
    Changes in api/maven-api-plugin/src/main/mdo/plugin.mdo:
    - Mojo.phase / executePhase: xsd.suggestions - all standard lifecycle phases
    - Mojo.dependencyResolution/dependencyCollection (v2.0.0+): xsd.suggestions 
(non-strict)
    - requiresDependencyResolution/requiresDependencyCollection (v1.x): 
xsd.enumerations (strict)
    
    This PR is a no-op at runtime — only the generated XSD schemas are affected,
    improving IDE support (IntelliJ, Eclipse m2e, VSCode) for POM and 
settings.xml editing.
---
 api/maven-api-model/src/main/mdo/maven.mdo                 | 14 +++++++-------
 api/maven-api-plugin/src/main/mdo/plugin.mdo               | 10 +++++-----
 api/maven-api-settings/src/main/mdo/settings.mdo           | 10 +++++-----
 .../internal/concurrent/BuildPlanCreatorTest.java          | 12 ++++++------
 pom.xml                                                    |  6 ++++++
 5 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/api/maven-api-model/src/main/mdo/maven.mdo 
b/api/maven-api-model/src/main/mdo/maven.mdo
index a50f804f7d..7c7dc7ae67 100644
--- a/api/maven-api-model/src/main/mdo/maven.mdo
+++ b/api/maven-api-model/src/main/mdo/maven.mdo
@@ -156,7 +156,7 @@
           <description>The current version of the artifact produced by this 
project.</description>
           <type>String</type>
         </field>
-        <field>
+        <field xsd.suggestions="jar,pom,bom,war,ear,ejb,rar,par,maven-plugin">
           <name>packaging</name>
           <version>4.0.0+</version>
           <description>
@@ -1233,7 +1233,7 @@
           </description>
           <type>String</type>
         </field>
-        <field>
+        <field 
xsd.suggestions="pom,bom,jar,fatjar,classpath-jar,modular-jar,processor,classpath-processor,modular-processor,java-source,javadoc,maven-plugin,test-jar,test-java-source,war,ear,ejb,rar,par,ejb-client">
           <name>type</name>
           <version>4.0.0+</version>
           <description>
@@ -1266,7 +1266,7 @@
           <type>String</type>
           <required>false</required>
         </field>
-        <field>
+        <field 
xsd.suggestions="none,compile-only,compile,runtime,provided,test-only,test,test-runtime,system,import">
           <name>scope</name>
           <version>4.0.0+</version>
           <description>
@@ -2380,7 +2380,7 @@
           </description>
           <type>String</type>
         </field>
-        <field>
+        <field xsd.suggestions="default,legacy">
           <name>layout</name>
           <version>4.0.0+</version>
           <description>
@@ -2452,7 +2452,7 @@
           </description>
           <type>String</type>
         </field>
-        <field>
+        <field xsd.suggestions="always,daily,never,interval:30">
           <name>updatePolicy</name>
           <version>4.0.0+</version>
           <description>
@@ -2464,7 +2464,7 @@
           </description>
           <type>String</type>
         </field>
-        <field>
+        <field xsd.enumerations="fail,warn,ignore">
           <name>checksumPolicy</name>
           <version>4.0.0+</version>
           <description>
@@ -2833,7 +2833,7 @@
           <description>The identifier of this execution for labelling the 
goals during the build,
             and for matching executions to merge during inheritance and 
profile injection.</description>
         </field>
-        <field>
+        <field 
xsd.suggestions="all,each,build,initialize,validate,sources,resources,compile,ready,package,verify,unit-test,test-sources,test-resources,test-compile,test,integration-test,install,deploy,clean,before:,after:">
           <name>phase</name>
           <version>4.0.0+</version>
           <type>String</type>
diff --git a/api/maven-api-plugin/src/main/mdo/plugin.mdo 
b/api/maven-api-plugin/src/main/mdo/plugin.mdo
index 92ae5ccd0e..80b42d984d 100644
--- a/api/maven-api-plugin/src/main/mdo/plugin.mdo
+++ b/api/maven-api-plugin/src/main/mdo/plugin.mdo
@@ -179,7 +179,7 @@ under the License.
           <defaultValue>java</defaultValue>
           <description>The implementation language for this Mojo (java, 
beanshell, etc.).</description>
         </field>
-        <field>
+        <field 
xsd.suggestions="all,each,build,initialize,validate,sources,resources,compile,ready,package,verify,unit-test,test-sources,test-resources,test-compile,test,integration-test,install,deploy,clean,before:,after:">
           <name>phase</name>
           <version>1.0.0+</version>
           <type>String</type>
@@ -208,7 +208,7 @@ under the License.
           <type>String</type>
           <description>Specifies the name of a custom lifecycle to execute 
when this Mojo is forking execution (used together with {@code 
executePhase}).</description>
         </field>
-        <field>
+        <field 
xsd.enumerations="compile,runtime,test,compile+runtime,runtime+system">
           <name>requiresDependencyResolution</name>
           <version>1.0.0/1.1.0</version>
           <type>String</type>
@@ -218,7 +218,7 @@ under the License.
             {@code compile+runtime} (since Maven 3.0) or {@code 
runtime+system} (since Maven 3.0)
           </description>
         </field>
-        <field>
+        <field 
xsd.suggestions="compile,runtime,test,compile+runtime,runtime+system,main-compile,main-runtime,test-compile,test-runtime,true">
           <name>dependencyResolution</name>
           <version>2.0.0+</version>
           <type>String</type>
@@ -228,7 +228,7 @@ under the License.
             {@code compile+runtime} (since Maven 3.0) or {@code 
runtime+system} (since Maven 3.0)
           </description>
         </field>
-        <field>
+        <field 
xsd.enumerations="compile,runtime,test,compile+runtime,runtime+system">
           <name>requiresDependencyCollection</name>
           <version>1.0.0/1.1.0</version>
           <type>String</type>
@@ -241,7 +241,7 @@ under the License.
             full dependency resolution might fail due to projects which 
haven't been built yet.
           </description>
         </field>
-        <field>
+        <field 
xsd.suggestions="compile,runtime,test,compile+runtime,runtime+system,main-compile,main-runtime,test-compile,test-runtime,true">
           <name>dependencyCollection</name>
           <version>2.0.0+</version>
           <type>String</type>
diff --git a/api/maven-api-settings/src/main/mdo/settings.mdo 
b/api/maven-api-settings/src/main/mdo/settings.mdo
index 3e67e89154..506470c1b4 100644
--- a/api/maven-api-settings/src/main/mdo/settings.mdo
+++ b/api/maven-api-settings/src/main/mdo/settings.mdo
@@ -437,7 +437,7 @@
           </description>
           <type>String</type>
         </field>
-        <field>
+        <field xsd.suggestions="http,https">
           <name>protocol</name>
           <version>1.0.0+</version>
           <description>
@@ -677,7 +677,7 @@
           <type>String</type>
           <description>The URL of the mirror repository.</description>
         </field>
-        <field>
+        <field xsd.suggestions="default,legacy">
           <name>layout</name>
           <version>1.1.0+</version>
           <type>String</type>
@@ -893,7 +893,7 @@
           </description>
           <type>String</type>
         </field>
-        <field>
+        <field xsd.suggestions="default,legacy">
           <name>layout</name>
           <version>1.0.0+</version>
           <description>
@@ -989,7 +989,7 @@
           <type>boolean</type>
           <defaultValue>true</defaultValue>
         </field>
-        <field>
+        <field xsd.suggestions="always,daily,never,interval:30">
           <name>updatePolicy</name>
           <version>1.0.0+</version>
           <description>
@@ -999,7 +999,7 @@
           </description>
           <type>String</type>
         </field>
-        <field>
+        <field xsd.enumerations="fail,warn,ignore">
           <name>checksumPolicy</name>
           <version>1.0.0+</version>
           <description>
diff --git 
a/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanCreatorTest.java
 
b/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanCreatorTest.java
index 2bce60223e..72466dc904 100644
--- 
a/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanCreatorTest.java
+++ 
b/impl/maven-core/src/test/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanCreatorTest.java
@@ -501,9 +501,9 @@ void testReactorPluginPreCompilePhase() {
         // Without the fix, "ready" (and compile/package/…) would be skipped 
for p2 because
         // "initialize" ends well before "ready" in the lifecycle.
         DefaultLifecycleRegistry lifecycles = new 
DefaultLifecycleRegistry(Collections.emptyList());
-        BuildPlanExecutor.BuildContext context =
-                new BuildPlanExecutor(null, null, null, null, null, null, 
null, null, lifecycles, null)
-                .new BuildContext();
+        BuildPlanExecutor.BuildContext context = new BuildPlanExecutor(
+                null, null, null, null, null, null, null, null, lifecycles, 
Collections.emptyList())
+        .new BuildContext();
 
         BuildPlan plan = context.calculateLifecycleMappings(projects, 
"initialize");
 
@@ -583,9 +583,9 @@ void 
testReactorPluginWithLibraryDependencyPreCompilePhase() {
         projects.put(p1, Collections.singletonList(p2));
 
         DefaultLifecycleRegistry lifecycles = new 
DefaultLifecycleRegistry(Collections.emptyList());
-        BuildPlanExecutor.BuildContext context =
-                new BuildPlanExecutor(null, null, null, null, null, null, 
null, null, lifecycles, null)
-                .new BuildContext();
+        BuildPlanExecutor.BuildContext context = new BuildPlanExecutor(
+                null, null, null, null, null, null, null, null, lifecycles, 
Collections.emptyList())
+        .new BuildContext();
 
         BuildPlan plan = context.calculateLifecycleMappings(projects, 
"initialize");
 
diff --git a/pom.xml b/pom.xml
index 48f3c889c2..f4dac2c360 100644
--- a/pom.xml
+++ b/pom.xml
@@ -167,6 +167,7 @@ under the License.
     <wagonVersion>3.5.3</wagonVersion>
     <woodstoxVersion>7.3.0</woodstoxVersion>
     <xmlunitVersion>2.14.0</xmlunitVersion>
+    <modelloVersion>2.9.0</modelloVersion>
     <jacocoArgLine />
     <argLine.xmx>-Xmx256m</argLine.xmx>
     <argLine.mockito />
@@ -718,6 +719,11 @@ under the License.
   <build>
     <pluginManagement>
       <plugins>
+        <plugin>
+          <groupId>org.codehaus.modello</groupId>
+          <artifactId>modello-maven-plugin</artifactId>
+          <version>${modelloVersion}</version>
+        </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>

Reply via email to