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


##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java:
##########
@@ -1270,6 +1277,22 @@ private void validate20RawDependencies(
                             dependency);
                 }
             }
+            // MNG-8099: api and implementation scopes require modelVersion 
4.2.0+
+            if (!is42OrBeyond) {
+                String scope = dependency.getScope();
+                if (DependencyScope.API.id().equals(scope)
+                        || DependencyScope.IMPLEMENTATION.id().equals(scope)) {
+                    addViolation(
+                            problems,
+                            Severity.ERROR,
+                            Version.V20,

Review Comment:
   🟡 **Wrong `Version` constant — should be `Version.V42`, not `Version.V20`**
   
   `ModelProblem.Version` has an explicit `V42` constant for "Validation for 
Maven 4.2 POM format". Using `V20` here mislabels this rule as a Maven 2.0 
constraint in problem reports, tooling, and diagnostics — it will appear as if 
the error applies to any Maven version rather than being a 4.2.0-specific 
validation.
   
   ```suggestion
                               Version.V42,
   ```



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