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


##########
impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/DefaultConsumerPomBuilder.java:
##########
@@ -582,8 +582,10 @@ private Model buildEffectiveModel(RepositorySystemSession 
session, MavenProject
                 }
                 return dependency;
             });
-            // Only keep transitive scopes (null/empty => COMPILE)
+            // Only keep consumer-visible scopes (compile, api, runtime, 
implementation)
             
directDependencies.values().removeIf(DefaultConsumerPomBuilder::hasDependencyScope);
+            // Map 4.2.0 scopes to their 4.0.0 consumer POM equivalents 
(api→compile, implementation→runtime)
+            directDependencies.replaceAll((k, v) -> mapScopeForConsumerPom(v));

Review Comment:
   🟡 **Redundant scope mapping in `buildNonPom` path**
   
   `buildEffectiveModel` maps scopes on direct deps here (and again at line 608 
for the other branch), but `buildNonPom` immediately passes the result to 
`transformNonPom`, which calls `mapScopesForConsumerPom(builder.build())` — 
covering direct deps, managed deps, and profile deps. So direct deps are mapped 
twice for non-POM projects.
   
   Since `mapScopeForConsumerPom` is idempotent, this is safe but redundant. 
Were the `replaceAll` calls in `buildEffectiveModel` intended to remain, or 
should the mapping be consolidated in `transformNonPom` only?



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