mfriedenhagen commented on code in PR #12707:
URL: https://github.com/apache/maven/pull/12707#discussion_r3830903831


##########
impl/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java:
##########
@@ -63,7 +61,7 @@ protected ProjectBuildingException(String projectId, String 
message, File pomFil
     }
 
     public ProjectBuildingException(List<ProjectBuildingResult> results) {
-        super(createMessage(results));
+        super("Some problems were encountered while processing the POMs");

Review Comment:
   Maybe only add the count of errors?
   
   ```suggestion
           super("Encountered %d problem(s) while processing the 
POMs".formatted(
                results.size()));
   ```



##########
impl/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java:
##########
@@ -179,4 +187,72 @@ void testHandleExceptionSelfReferencing() {
         assertEquals(0, summary.getChildren().size());
         assertEquals(boom1, summary.getException());
     }
+
+    @Test
+    void testProjectBuildingExceptionNotRenderedTwice() {
+        ModelProblem problem = new DefaultModelProblem(
+                "Malformed POM test.xml: unexpected element",
+                ModelProblem.Severity.FATAL,
+                null,
+                "test.xml",
+                8,
+                3,
+                null,
+                null);
+
+        ProjectBuildingResult result = mock(ProjectBuildingResult.class);
+        when(result.getProjectId()).thenReturn("test:fail-build:0.1-SNAPSHOT");
+        when(result.getPomFile()).thenReturn(new File("test.xml"));
+        when(result.getProblems()).thenReturn(List.of(problem));
+
+        ProjectBuildingException exception = new 
ProjectBuildingException(List.of(result));
+
+        assertEquals(
+                "Some problems were encountered while processing the POMs",

Review Comment:
   ```suggestion
                   "Encountered 1 problem(s) while processing the POMs",
   ```



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