void addDependencySet()

in src/main/java/org/apache/maven/plugins/assembly/archive/task/AddDependencySetsTask.java [120:166]


    void addDependencySet(
            final DependencySet dependencySet, final Archiver archiver, final AssemblerConfigurationSource configSource)
            throws AssemblyFormattingException, ArchiveCreationException, InvalidAssemblerConfigurationException {
        LOGGER.debug("Processing DependencySet (output=" + dependencySet.getOutputDirectory() + ")");

        if (!dependencySet.isUseTransitiveDependencies() && dependencySet.isUseTransitiveFiltering()) {
            LOGGER.warn("DependencySet has nonsensical configuration: useTransitiveDependencies == false "
                    + "AND useTransitiveFiltering == true. Transitive filtering flag will be ignored.");
        }

        final Set<Artifact> dependencyArtifacts = resolveDependencyArtifacts(dependencySet);

        if (!unpackTransformsContent(dependencySet) && dependencyArtifacts.size() > 1) {
            checkMultiArtifactOutputConfig(dependencySet);
        }

        LOGGER.debug("Adding " + dependencyArtifacts.size() + " dependency artifacts.");

        UnpackOptions unpackOptions = dependencySet.getUnpackOptions();
        InputStreamTransformer fileSetTransformers = isUnpackWithOptions(dependencySet)
                ? ReaderFormatter.getFileSetTransformers(
                        configSource,
                        unpackOptions.isFiltered(),
                        new HashSet<>(unpackOptions.getNonFilteredFileExtensions()),
                        unpackOptions.getLineEnding())
                : null;

        for (final Artifact depArtifact : dependencyArtifacts) {
            ProjectBuildingRequest pbr = getProjectBuildingRequest(configSource);
            MavenProject depProject;
            try {
                ProjectBuildingResult build = projectBuilder1.build(depArtifact, pbr);
                depProject = build.getProject();
            } catch (final ProjectBuildingException e) {
                LOGGER.debug("Error retrieving POM of module-dependency: " + depArtifact.getId() + "; Reason: "
                        + e.getMessage() + "\n\nBuilding stub project instance.");

                depProject = buildProjectStub(depArtifact);
            }

            if (NON_ARCHIVE_DEPENDENCY_TYPES.contains(depArtifact.getType())) {
                addNonArchiveDependency(depArtifact, depProject, dependencySet, archiver, configSource);
            } else {
                addNormalArtifact(dependencySet, depArtifact, depProject, archiver, configSource, fileSetTransformers);
            }
        }
    }