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


##########
impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/DefaultConsumerPomBuilder.java:
##########
@@ -369,19 +371,33 @@ static Model transformPom(Model model, MavenProject 
project) {
 
         // raw to consumer transform
         model = model.withRoot(false).withModules(null).withSubprojects(null);
-        if (model.getParent() != null) {
-            model = model.withParent(model.getParent().withRelativePath(null));
+        Parent parent = model.getParent();
+        if (parent != null) {
+            model = model.withParent(parent.withRelativePath(null));
+        }
+        var sources = new ProjectSourcesHelper(project);
+        if (sources.useModuleSourceHierarchy()) {
+            // Dependencies are dispatched by maven-jar-plugin in the POM 
generated for each module.
+            model = model.withDependencies(null).withPackaging(POM_PACKAGING);
         }
-
         if (!preserveModelVersion) {
+            /*
+             * If tne <build> contains <source> elements, it is not compatible 
with the Maven 4.0.0 model.
+             * Remove the full <build> element instead of removing only the 
<sources> element, because the
+             * build without sources does not mean much. Reminder: this 
removal can be disabled by setting

Review Comment:
   The suggested change seems strange. It replaces the middle of a sentence 
("build without sources …") by a copy of the first sentence. I suspect that the 
intend was to replace the first sentence for fixing the "n" in "the".



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