Skip to content

Commit de45aea

Browse files
committed
Fixes #10950: Throw ProjectBuildingException for reactor cycles; keep CycleDetectedException as cause.
Non-cycle model problems still use ProjectBuildingException(results). Remove misleading comment about projectId/pomFile.
1 parent 735fd50 commit de45aea

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import java.util.stream.Collectors;
4545
import java.util.stream.Stream;
4646

47-
import org.apache.maven.ProjectCycleException;
4847
import org.apache.maven.RepositoryUtils;
4948
import org.apache.maven.api.ArtifactCoordinates;
5049
import org.apache.maven.api.Language;
@@ -492,10 +491,14 @@ List<ProjectBuildingResult> build(List<File> pomFiles, boolean recursive) throws
492491
.findAny()
493492
.orElse(null);
494493
if (cycle != null) {
495-
throw new RuntimeException(new ProjectCycleException(
494+
final CycleDetectedException cde = (CycleDetectedException) cycle.getException();
495+
throw new ProjectBuildingException(
496+
null,
496497
"The projects in the reactor contain a cyclic reference: " + cycle.getMessage(),
497-
(CycleDetectedException) cycle.getException()));
498+
null,
499+
cde);
498500
}
501+
499502
throw new ProjectBuildingException(results);
500503
}
501504

0 commit comments

Comments
 (0)