gnodet commented on issue #11979: URL: https://github.com/apache/maven/issues/11979#issuecomment-4776630022
## Analysis: Required Model Fields vs Validation Investigation of the gap between MDO `<required>` annotations and actual `DefaultModelValidator` checks. ### Validation Architecture Maven validates POMs in 3 ordered phases in `DefaultModelValidator`: - **`validateFileModel`** — raw XML as parsed (modelVersion, duplicate declarations) - **`validateRawModel`** — after profile activation, before inheritance (coordinates, URLs, modules) - **`validateEffectiveModel`** — fully resolved model (all coordinates present, no \ remnants) ### Assessment of 11 Unvalidated Fields | Field | Risk | Has Default? | Recommendation | |---|---|---|---| | `Contributor.name`, `Developer.id/name`, `License.name`, `MailingList.name`, `Organization.name`, `Site.id` | Low | No | **Fix MDO** — remove `required`. Metadata, not build-critical. Enforcing would break POMs. | | `Dependency.type` | None | Yes (`jar`) | **Leave as-is** — Modello injects the default. | | `Plugin.groupId` | None | Yes (`o.a.m.plugins`) | **Leave as-is** — default injected. | | `Extension.groupId` | **Medium** | No | **Add validation** in `validateRawModel` — missing causes cryptic downstream errors. | | `Extension.artifactId` | **Medium** | No | **Add validation** in `validateRawModel` — same. | ### PR #11985 Status Merged to `maven-3.10.x` — removed `required` from the 7 metadata-only fields. **Not yet forward-ported** to `master` or `maven-4.0.x`. ### Recommended Next Steps - **4.0.0-rc-6:** Forward-port MDO annotation fixes from #11985 (no behavioral change, just corrects metadata). - **4.1.0:** Add `validateRawModel` checks for `Extension.groupId/artifactId` — emit warning initially, escalate to error in a later release. -- 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]
