Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.maven.ProjectCycleException;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.api.ArtifactCoordinates;
import org.apache.maven.api.Language;
Expand Down Expand Up @@ -492,10 +491,14 @@ List<ProjectBuildingResult> build(List<File> pomFiles, boolean recursive) throws
.findAny()
.orElse(null);
if (cycle != null) {
throw new RuntimeException(new ProjectCycleException(
final CycleDetectedException cde = (CycleDetectedException) cycle.getException();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wrapping still smells like something's not quite right. The code is quite complex, and it might be simpler without the lambda, but either way we really should be able to just throw the CycleDetectedException. This is not a public method so we can easily add that to the method signature. It's also possible CycleDetectedException should be a subclass of ProjectBuildingException.

throw new ProjectBuildingException(
null,
"The projects in the reactor contain a cyclic reference: " + cycle.getMessage(),
(CycleDetectedException) cycle.getException()));
null,
cde);
}

throw new ProjectBuildingException(results);
}

Expand Down
Loading