Forward-port #11985: remove redundant required MDO attrs (#11979)#12347
Open
gnodet wants to merge 1 commit into
Open
Forward-port #11985: remove redundant required MDO attrs (#11979)#12347gnodet wants to merge 1 commit into
gnodet wants to merge 1 commit into
Conversation
Remove <required>true</required> from 13 metadata/defaulted fields in maven.mdo (forward-port of PR #11985 from maven-3.10.x). Update Model.name description to document artifactId fallback. Add minimal POM validation tests.
slachiewicz
approved these changes
Jun 24, 2026
There was a problem hiding this comment.
Pull request overview
Forward-port of model-descriptor metadata cleanup to maven-4.0.x, removing redundant <required>true</required> flags from maven.mdo fields that are not actually validated as required, and adding regression tests/resources to ensure “minimal” raw models validate cleanly (with and without <parent>).
Changes:
- Removed redundant
requiredannotations from multiple fields inapi/maven-api-model/src/main/mdo/maven.mdo. - Added “minimal” raw-model POM fixtures (with/without parent) under test resources.
- Added compat
DefaultModelValidatorTestcoverage to assert zero violations for those minimal raw models.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
api/maven-api-model/src/main/mdo/maven.mdo |
Removes misleading required metadata; updates one field description. |
compat/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java |
Adds new tests to validate minimal raw models with/without parent. |
compat/maven-model-builder/src/test/resources/poms/validation/raw-model/minimal-with-parent.xml |
Test POM fixture for “minimal with parent”. |
compat/maven-model-builder/src/test/resources/poms/validation/raw-model/minimal-without-parent.xml |
Test POM fixture for “minimal without parent”. |
impl/maven-core/src/main/java/org/apache/maven/project/MavenProject.java |
Removes outdated TODO comment related to nullable project name. |
impl/maven-impl/src/test/resources/poms/validation/raw-model/minimal-with-parent.xml |
Adds impl-side copy of minimal fixture (currently unused). |
impl/maven-impl/src/test/resources/poms/validation/raw-model/minimal-without-parent.xml |
Adds impl-side copy of minimal fixture (currently unused). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
165
to
169
| <field xdoc.separator="blank"> | ||
| <name>name</name> | ||
| <version>3.0.0+</version> | ||
| <required>true</required> | ||
| <description>The full name of the project.</description> | ||
| <description>The full name of the project. If not specified, the artifactId will be used.</description> | ||
| <type>String</type> |
Comment on lines
+19
to
+33
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
|
||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>org.apache.maven.validation</groupId> | ||
| <artifactId>parent</artifactId> | ||
| <version>1</version> | ||
| </parent> | ||
|
|
||
| <artifactId>project</artifactId> | ||
|
|
||
| </project> |
Comment on lines
+19
to
+29
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
|
||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>groupId</groupId> | ||
| <artifactId>project</artifactId> | ||
| <version>project</version> | ||
|
|
||
| </project> |
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.
Forward-port of PR #11985 from maven-3.10.x to maven-4.0.x.
Removes
<required>true</required>from 13 fields inmaven.mdothat were never validated. No behavioral change — just corrects the model descriptor metadata.Ref: #11979