Skip to content

Commit 41af7cf

Browse files
committed
Do not wrap non build exceptions
1 parent dee4667 commit 41af7cf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilder.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import org.apache.maven.api.model.Repository;
7474
import org.apache.maven.api.services.BuilderProblem;
7575
import org.apache.maven.api.services.BuilderProblem.Severity;
76+
import org.apache.maven.api.services.MavenException;
7677
import org.apache.maven.api.services.ModelBuilder;
7778
import org.apache.maven.api.services.ModelBuilderException;
7879
import 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

Comments
 (0)