gnodet-bot commented on code in PR #13086:
URL: https://github.com/apache/maven/pull/13086#discussion_r4018827465


##########
compat/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java:
##########
@@ -984,7 +984,10 @@ private ModelData readParentLocally(
             buffer.append(parent.getArtifactId()).append(", please verify your 
project structure");
 
             problems.setSource(childModel);
-            problems.add(new ModelProblemCollectorRequest(Severity.WARNING, 
Version.BASE)
+            // When <relativePath> is omitted Maven defaults to ../pom.xml; 
downgrade to WARNING
+            // (not FATAL) in that case — same behaviour as the Maven 4 
DefaultModelBuilder.
+            Severity severity = (parent.getRelativePath() == null) ? 
Severity.WARNING : Severity.FATAL;

Review Comment:
   🔴 **Missing test — explicitly requested by gnodet.**
   
   gnodet's review said: *"Also please add a test case covering the scenario 
where `<relativePath>` is omitted and the default `../pom.xml` has a mismatched 
GA — verifying that a WARNING (not FATAL, and not silence) is produced."*
   
   No test has been added. The logic change here is non-trivial — the original 
compat code was `Severity.WARNING` unconditionally, and this PR escalates 
explicit `<relativePath>` mismatches to `FATAL`. Both code paths need 
regression coverage:
   
   1. `relativePath == null` (default `../pom.xml`, mismatched GA) → must 
produce exactly one `WARNING`
   2. `relativePath` explicitly set to a mismatched POM → must produce a 
`FATAL` error
   
   Without tests, future refactoring will silently regress this fix.



-- 
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]

Reply via email to