pzygielo commented on code in PR #405:
URL: https://github.com/apache/maven-help-plugin/pull/405#discussion_r3743140785


##########
src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java:
##########
@@ -197,6 +197,16 @@ private void writeEffectivePom(MavenProject project, 
XMLWriter writer) throws Mo
         // This removes the XML declaration written by MavenXpp3Writer
         String effectivePom = prettyFormat(sWriter.toString(), null, true);
 
+        // MavenXpp3Writer omits packaging when it is null or "jar" (the 
default).
+        // Ensure it is always present so users can see the effective 
packaging value.
+        if (pom.getPackaging() == null || "jar".equals(pom.getPackaging())) {
+            String packaging = pom.getPackaging() != null ? pom.getPackaging() 
: project.getPackaging();
+            String packagingTag = "  <packaging>" + packaging + "</packaging>";
+            if (!effectivePom.contains(packagingTag)) {
+                effectivePom = effectivePom.replace("</version>" + LS, 
"</version>" + LS + packagingTag + LS);

Review Comment:
   To clarify above - even without any modification to this PR - manual 
inspection of `target/it/effective-pom-packaging/build.log` shows that too much 
is done to the effective pom. 
   
   Perhaps `src/it/projects/effective-pom-packaging/verify.groovy` could be 
fixed to check that only expected changes are there (i.e. no unexpected changes 
are).



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