diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java index 5d4e37fb7234..b2264fc57611 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java @@ -23,6 +23,8 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.apache.maven.RepositoryUtils; import org.apache.maven.model.Dependency; @@ -223,8 +225,13 @@ private DependencyNode resolveInternal( throw new PluginResolutionException( plugin, e.getResult().getExceptions(), logger.isDebugEnabled() ? e : null); } catch (DependencyResolutionException e) { - throw new PluginResolutionException( - plugin, e.getResult().getCollectExceptions(), logger.isDebugEnabled() ? e : null); + List exceptions = Stream.concat( + e.getResult().getCollectExceptions().stream(), + e.getResult().getArtifactResults().stream() + .filter(r -> !r.isResolved()) + .flatMap(r -> r.getExceptions().stream())) + .collect(Collectors.toList()); + throw new PluginResolutionException(plugin, exceptions, logger.isDebugEnabled() ? e : null); } return node;