7373import org .apache .maven .api .model .Repository ;
7474import org .apache .maven .api .services .BuilderProblem ;
7575import org .apache .maven .api .services .BuilderProblem .Severity ;
76+ import org .apache .maven .api .services .MavenException ;
7677import org .apache .maven .api .services .ModelBuilder ;
7778import org .apache .maven .api .services .ModelBuilderException ;
7879import org .apache .maven .api .services .ModelBuilderRequest ;
@@ -739,6 +740,7 @@ private void buildBuildPom() throws ModelBuilderException {
739740 // For the top model and all its children, build the effective model.
740741 // This is done through the phased executor
741742 var allResults = results (result ).toList ();
743+ MavenException fatalException = new MavenException ();
742744 try (PhasingExecutor executor = createExecutor ()) {
743745 for (DefaultModelBuilderResult r : allResults ) {
744746 executor .execute (() -> {
@@ -748,13 +750,16 @@ private void buildBuildPom() throws ModelBuilderException {
748750 } catch (ModelBuilderException e ) {
749751 // gathered with problem collector
750752 } catch (Exception t ) {
751- mbs . add ( Severity . FATAL , ModelProblem . Version . BASE , t . getMessage (), t );
753+ fatalException . addSuppressed ( t );
752754 }
753755 });
754756 }
755757 }
756758
757759 // Check for errors again after execution
760+ if (fatalException .getSuppressed ().length > 0 ) {
761+ throw fatalException ;
762+ }
758763 if (hasErrors ()) {
759764 throw newModelBuilderException ();
760765 }
0 commit comments