public Set resolveAll()

in plugins/maven/src/main/java/org/wildfly/swarm/plugin/maven/MavenArtifactResolvingHelper.java [124:206]


    public Set<ArtifactSpec> resolveAll(Collection<ArtifactSpec> specs, boolean transitive, boolean defaultExcludes) throws Exception {
        if (specs.isEmpty()) {
            return Collections.emptySet();
        }
        List<DependencyNode> nodes;
        if (transitive) {

            final CollectRequest request = new CollectRequest();
            request.setRepositories(this.remoteRepositories);

            // SWARM-1031
            if (this.dependencyManagement != null) {
                List<Dependency> managedDependencies = this.dependencyManagement.getDependencies()
                        .stream()
                        .map(mavenDep -> {
                            DefaultArtifact artifact = new DefaultArtifact(
                                    mavenDep.getGroupId(),
                                    mavenDep.getArtifactId(),
                                    mavenDep.getClassifier(),
                                    typeToExtension(mavenDep.getType()),
                                    mavenDep.getVersion(),
                                    new DefaultArtifactType(mavenDep.getType())
                            );
                            return new Dependency(artifact, mavenDep.getScope());
                        })
                        .collect(Collectors.toList());

                request.setManagedDependencies(managedDependencies);
            }

            specs.forEach(spec -> request
                    .addDependency(new Dependency(new DefaultArtifact(spec.groupId(),
                            spec.artifactId(),
                            spec.classifier(),
                            typeToExtension(spec.type()),
                            spec.version(),
                            new DefaultArtifactType(spec.type())),
                            "compile")));

            RepositorySystemSession tempSession
                    = new RepositorySystemSessionWrapper(this.session, defaultExcludes
            );
            CollectResult result = this.system.collectDependencies(tempSession, request);
            PreorderNodeListGenerator gen = new PreorderNodeListGenerator();
            result.getRoot().accept(gen);
            nodes = gen.getNodes();
        } else {
            nodes = new ArrayList<>();
            for (ArtifactSpec spec : specs) {
                Dependency dependency = new Dependency(new DefaultArtifact(spec.groupId(),
                        spec.artifactId(),
                        spec.classifier(),
                        typeToExtension(spec.type()),
                        spec.version(),
                        new DefaultArtifactType(spec.type())),
                        "compile");
                DefaultDependencyNode node = new DefaultDependencyNode(dependency);
                nodes.add(node);
            }
        }

        List<DependencyNode> extraDependencies = ExtraArtifactsHandler.getExtraDependencies(nodes);

        nodes.addAll(extraDependencies);

        resolveDependenciesInParallel(nodes);

        return nodes.stream()
                .filter(node -> !"system".equals(node.getDependency().getScope()))
                .map(node -> {
                    final Artifact artifact = node.getArtifact();
                    return new ArtifactSpec(node.getDependency().getScope(),
                            artifact.getGroupId(),
                            artifact.getArtifactId(),
                            artifact.getVersion(),
                            artifact.getProperty(ArtifactProperties.TYPE, null),
                            artifact.getClassifier(),
                            null);
                })
                .map(this::resolve)
                .filter(Objects::nonNull)
                .collect(Collectors.toSet());
    }