[MNG-8182] Resolved errors were created based on collect exceptions (#1635)

Hence, they missed resolution errors.

---

https://issues.apache.org/jira/browse/MNG-8182
This commit is contained in:
Tamas Cservenak 2024-08-09 23:10:29 +02:00 committed by GitHub
parent 1daa1d52b6
commit 5ec110672e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

View File

@ -25,6 +25,8 @@ import javax.inject.Singleton;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.api.DependencyScope;
@ -234,8 +236,13 @@ public class DefaultPluginDependenciesResolver implements PluginDependenciesReso
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<Exception> 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);
}
}
}