desruisseaux commented on code in PR #11780:
URL: https://github.com/apache/maven/pull/11780#discussion_r2913396564


##########
impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/DefaultConsumerPomBuilder.java:
##########
@@ -408,13 +411,66 @@ static Model transformPom(Model model, MavenProject 
project) {
             if (SourceQueries.hasEnabledSources(projectSources)) {
                 model = model.withBuild(null);
             }
+            // Strip 4.1.0 features to produce a 4.0.0-compatible consumer POM.
+            // Maven 4 builds resolve the "build" classifier POM for full 
fidelity,
+            // so stripping here only affects Maven 3/Gradle consumers who 
cannot
+            // understand these features anyway.
+            model = stripTo400(model);
             model = model.withPreserveModelVersion(false);
             String modelVersion = new 
MavenModelVersion().getModelVersion(model);
             model = model.withModelVersion(modelVersion);
         }
         return model;
     }
 
+    /**
+     * Strips 4.1.0 features from the model to produce a 4.0.0-compatible 
consumer POM.
+     * This removes features that Maven 3 cannot understand:
+     * <ul>
+     *   <li>Profile condition activation</li>
+     *   <li>Profile packaging activation</li>
+     *   <li>Extension configuration</li>
+     * </ul>
+     * Note: mixins cannot be stripped this way (they bring content).
+     * If the model still requires &gt; 4.0.0 after stripping, the caller 
should handle it.
+     */
+    static Model stripTo400(Model model) {

Review Comment:
   Maybe this method can be kept `private`?



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