gnodet opened a new pull request, #13930: URL: https://github.com/apache/maven/pull/13930
## Summary Leverages [codehaus-plexus/modello#634](https://github.com/codehaus-plexus/modello/pull/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 bumped to `2.8.2-SNAPSHOT` in the root `pluginManagement` to unlock this feature (pending the official release of modello #634). ## Changes ### `api/maven-api-model/src/main/mdo/maven.mdo` | Field | Annotation | Reason | |---|---|---| | `Dependency.scope` | `xsd.enumerations` (strict) | Fixed set: compile/provided/runtime/test/system/import | | `Dependency.type` | `xsd.suggestions` (non-strict) | Plugins can define new types | | `Model.packaging` | `xsd.suggestions` (non-strict) | Plugins can define new packaging types | | `PluginExecution.phase` | `xsd.suggestions` (non-strict) | Custom phases possible via extensions | | `RepositoryBase.layout` | `xsd.suggestions` (non-strict) | legacy/default, may be extended | | `RepositoryPolicy.checksumPolicy` | `xsd.enumerations` (strict) | Fixed set: fail/warn/ignore | | `RepositoryPolicy.updatePolicy` | `xsd.suggestions` (non-strict) | interval:NNN is open-ended | ### `api/maven-api-settings/src/main/mdo/settings.mdo` | Field | Annotation | Reason | |---|---|---| | `Proxy.protocol` | `xsd.suggestions` (non-strict) | Custom proxy protocols possible | | `Mirror.layout` / `Repository.layout` | `xsd.suggestions` (non-strict) | As above | | `RepositoryPolicy.checksumPolicy` | `xsd.enumerations` (strict) | Fixed set | | `RepositoryPolicy.updatePolicy` | `xsd.suggestions` (non-strict) | interval:NNN is open | ### `api/maven-api-plugin/src/main/mdo/plugin.mdo` | Field | Annotation | Reason | |---|---|---| | `Mojo.phase` | `xsd.suggestions` (non-strict) | Custom phases via extensions | | `Mojo.dependencyResolution` / `dependencyCollection` | `xsd.enumerations` (strict) | Fixed set per Maven API | | `requiresDependencyResolution` / `requiresDependencyCollection` | `xsd.enumerations` (strict) | Same | ## Effect on Generated XSD **Strict enumeration** (`xsd.enumerations`) → `xs:restriction` with `xs:enumeration` values: ```xml <xs:element minOccurs="0" name="scope"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="compile"/> <xs:enumeration value="provided"/> ... </xs:restriction> </xs:simpleType> </xs:element> ``` **Non-strict suggestions** (`xsd.suggestions`) → `xs:union` giving IDE autocompletion without schema rejection: ```xml <xs:element minOccurs="0" name="packaging"> <xs:simpleType> <xs:union> <xs:simpleType><xs:restriction base="xs:string"> <xs:enumeration value="jar"/> ... </xs:restriction></xs:simpleType> <xs:simpleType><xs:restriction base="xs:string"/></xs:simpleType> </xs:union> </xs:simpleType> </xs:element> ``` 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. Depends on: https://github.com/codehaus-plexus/modello/pull/634 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
