Generates a warning message listing a summary of dependencies and their
associated CPE and CVE entries.

@param projectName the name of the project
@param dependencies a list of dependency objects
187348
public static void showSummary(String projectName, Dependency[] dependencies) {
        final StringBuilder summary = new StringBuilder();
        for (Dependency d : dependencies) {
            final String ids = d.getVulnerabilities(true).stream()
                    .map(v -> v.getName())
                    .collect(Collectors.joining(", "));
            if (ids.length() > 0) {
                summary.append(d.getFileName()).append(" (");
                summary.append(Stream.concat(d.getSoftwareIdentifiers().stream(), d.getVulnerableSoftwareIdentifiers().stream())
                        .map(i -> i.getValue())
                        .collect(Collectors.joining(", ")));
                summary.append(") : ").append(ids).append(NEW_LINE);
            }
        }
        if (summary.length() > 0) {
            if (projectName == null || projectName.isEmpty()) {
                LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities:\n\n{}\n\n"
                        + "See the dependency-check report for more details.\n\n",
                        summary.toString());
            } else {
                LOGGER.warn("\n\nOne or more dependencies were identified with known vulnerabilities in {}:\n\n{}\n\n"
                        + "See the dependency-check report for more details.\n\n",
                        projectName,
                        summary.toString());
            }
        }
    }
611195
private void extractConfigureScriptEvidence(Dependency dependency,
            final String name, final String contents) {
        final Matcher matcher = PACKAGE_VAR.matcher(contents);
        while (matcher.find()) {
            final String variable = matcher.group(1);
            final String value = matcher.group(2);
            if (!value.isEmpty()) {
                if (variable.endsWith("NAME")) {
                    dependency.addEvidence(EvidenceType.PRODUCT, name, variable, value, Confidence.HIGHEST);
                } else if ("VERSION".equals(variable)) {
                    dependency.addEvidence(EvidenceType.VERSION, name, variable, value, Confidence.HIGHEST);
                } else if ("BUGREPORT".equals(variable)) {
                    dependency.addEvidence(EvidenceType.VENDOR, name, variable, value, Confidence.HIGH);
                } else if ("URL".equals(variable)) {
                    dependency.addEvidence(EvidenceType.VENDOR, name, variable, value, Confidence.HIGH);
                }
            }
        }
    }
147048
private void processDependencies()
            throws MojoExecutionException
    {

        processDependency( getProject().getArtifact() );

        AndArtifactFilter filter = new AndArtifactFilter();
        // filter.add( new ScopeArtifactFilter( dependencySet.getScope() ) );

        if ( dependencies != null && dependencies.getIncludes() != null && !dependencies.getIncludes().isEmpty() )
        {
            filter.add( new IncludesArtifactFilter( dependencies.getIncludes() ) );
        }
        if ( dependencies != null && dependencies.getExcludes() != null && !dependencies.getExcludes().isEmpty() )
        {
            filter.add( new ExcludesArtifactFilter( dependencies.getExcludes() ) );
        }

        Collection<Artifact> artifacts =
                isExcludeTransitive() ? getProject().getDependencyArtifacts() : getProject().getArtifacts();

        for ( Artifact artifact : artifacts )
        {
            if ( filter.include( artifact ) )
            {
                processDependency( artifact );
            }
        }
    }
390677
public static String generate(org.sonatype.aether.graph.Dependency dependency) {
        return dependency.getArtifact().toString();
    }
1341866
@Override
  public ValidationReport loadProjectFlow(final Project project, final File projectDir) {
    this.propsList = new ArrayList<>();
    this.flowPropsList = new ArrayList<>();
    this.jobPropsMap = new HashMap<>();
    this.nodeMap = new HashMap<>();
    this.duplicateJobs = new HashSet<>();
    this.nodeDependencies = new HashMap<>();
    this.rootNodes = new HashSet<>();
    this.flowDependencies = new HashMap<>();

    // Load all the props files and create the Node objects
    loadProjectFromDir(projectDir.getPath(), projectDir, null);

    // Create edges and find missing dependencies
    resolveDependencies();

    // Create the flows.
    buildFlowsFromDependencies();

    // Resolve embedded flows
    resolveEmbeddedFlows();

    FlowLoaderUtils.checkJobProperties(project.getId(), this.props, this.jobPropsMap, this.errors);

    return FlowLoaderUtils.generateFlowLoaderReport(this.errors);

  }
726119
private static String buildErrorMsg(List<String> dependencies, String message) {
        final StringBuilder buffer = new StringBuilder();
        boolean isFirstElement = true;
        for (String dependency : dependencies) {
            if (!isFirstElement) {
                buffer.append(", ");
            }
            // check if it is an instance of Artifact - add the gavc else append the object
            buffer.append(dependency);

            isFirstElement = false;
        }
        return String.format(message, buffer.toString());
    }
1350863
private void validateExtension(LocalExtension localExtension, boolean dependencies)
    {
        Collection<String> namespaces = DefaultInstalledExtension.getNamespaces(localExtension);

        if (namespaces == null) {
            if (dependencies || !DefaultInstalledExtension.isDependency(localExtension, null)) {
                try {
                    validateExtension(localExtension, null, Collections.emptyMap());
                } catch (InvalidExtensionException e) {
                    if (this.logger.isDebugEnabled()) {
                        this.logger.warn("Invalid extension [{}]", localExtension.getId(), e);
                    } else {
                        this.logger.warn("Invalid extension [{}] ({})", localExtension.getId(),
                            ExceptionUtils.getRootCauseMessage(e));
                    }

                    addInstalledExtension(localExtension, null, false);
                }
            }
        } else {
            for (String namespace : namespaces) {
                if (dependencies || !DefaultInstalledExtension.isDependency(localExtension, namespace)) {
                    try {
                        validateExtension(localExtension, namespace, Collections.emptyMap());
                    } catch (InvalidExtensionException e) {
                        if (this.logger.isDebugEnabled()) {
                            this.logger.warn("Invalid extension [{}] on namespace [{}]", localExtension.getId(),
                                namespace, e);
                        } else {
                            this.logger.warn("Invalid extension [{}] on namespace [{}] ({})", localExtension.getId(),
                                namespace, ExceptionUtils.getRootCauseMessage(e));
                        }

                        addInstalledExtension(localExtension, namespace, false);
                    }
                }
            }
        }
    }
71975
@Override
	public void dependenciesLoaded(IDependencies deps, long sequence) {
		/*
		 * Aggregate the dependent features from all the modules into a single,
		 * alphabetically sorted, list of features.
		 */
		Set<String> features = new TreeSet<String>();
		try {
			for (String mid : deps.getDependencyNames()) {
				features.addAll(deps.getDependentFeatures(mid));
			}
			dependentFeatures = Collections.unmodifiableList(Arrays.asList(features.toArray(new String[features.size()])));
			depFeatureListResource = createFeatureListResource(dependentFeatures, getFeatureListResourceUri(), deps.getLastModified());
			generateModuleIdMap(deps);
			depsInitialized.countDown();
		} catch (ProcessingDependenciesException e) {
			if (log.isLoggable(Level.WARNING)) {
				log.log(Level.WARNING, e.getMessage(), e);
			}
			// Don't clear the latch as another call to this method can be expected soon
		} catch (Throwable t) {
			if (log.isLoggable(Level.SEVERE)) {
				log.log(Level.SEVERE, t.getMessage(), t);
			}
			// Clear the latch to allow the waiting thread to wake up.  If
			// dependencies have never been initialized, then NullPointerExceptions
			// will be thrown for any threads trying to access the uninitialized
			// dependencies.
			depsInitialized.countDown();

		}
	}
931587
void onCompletion(Collection<ApplicationDependency> dependencies) {
        if (!dependencies.isEmpty()) {
            for (ApplicationDependency dependency : dependencies) {
                dependency.onCompletion(this);
            }
        }
    }
1193582
private void resolveDependencies() throws RuntimeWarning {
        // d684950
        if (EJSPlatformHelper.isZOSCRA()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "resolveDependencies: skipped in adjunct process");
            return;
        }

        // F743-20281 - If an exception happened during early dependency
        // resolution, then fail the application.
        if (ivSingletonDependencyResolutionException != null) {
            throw ivSingletonDependencyResolutionException;
        }

        // Beans currently on a dependency list. If A->B->C->A, then used={A}
        // then used={A,B} then used={A,B,C} then C->A is an error because A
        // is already in the set.
        Set<BeanMetaData> used = new HashSet<BeanMetaData>();

        // F7434950.CodRev - Create a copy of the key list since
        // resolveBeanDependencies will modify ivSingletonDependencies.
        for (BeanMetaData bmd : new ArrayList<BeanMetaData>(ivSingletonDependencies.keySet())) {
            used.add(bmd);
            resolveBeanDependencies(bmd, used);
            used.remove(bmd);
        }
    }
779118
function mapDependencies(dependencies) {
  var deps;

  deps = (dependencies) ? Object.keys(dependencies) : [];

  return deps.map(function(name) {
    return {
      name: name,
      version: dependencies[name]
    };
  });
}
169554
public static String[] getArrayOfVersions(Map< String, Dependency> dependencies) {
        List<String> versionList = new LinkedList<String>();

        for (Dependency dependency : dependencies.values()) {
            versionList.add(dependency.getVersion());
        }

        return versionList.toArray(new String[versionList.size()]);
    }
532892
@Override
    protected ResolutionResult resolveDependencies(String projectFolder, String topLevelFolder, Set<String> paketDependenciesFiles) {
        boolean installSuccess = true;
        Collection<DependencyInfo> dependencies = new ArrayList<>();
        List<String> excludes = new LinkedList<>();
        if (paketRunPreStep) {
            File paket = new File(topLevelFolder + Constants.FORWARD_SLASH + PAKET_EXE);
            if (StringUtils.isNotEmpty(this.paketPath)) {
                paket = new File(this.paketPath);
            } else if (!paket.exists()) {
                paket = null;
            }
            installSuccess = !executePreparationStep(topLevelFolder, paket);
        }
        if (installSuccess) {
            String paketLockPath = topLevelFolder + Constants.FORWARD_SLASH + PAKET_LOCK;
            File paketLockFile = new File(paketLockPath);
            if (paketLockFile.exists()) {
                logger.debug("Found paket.lock file: {}", paketLockPath);
                Map<String, List<String>> groupToDirectDependenciesMap = getGroupToDirectDependencies(paketDependenciesFiles.iterator().next());
                if (groupToDirectDependenciesMap != null && !groupToDirectDependenciesMap.keySet().isEmpty()) {
                    Collection<AbstractPaketDependencyCollector> paketDependencyCollectors = new LinkedList<>();
                    for(String groupName : groupToDirectDependenciesMap.keySet()) {
                        if (groupName.equals(MAIN)) {
                            paketDependencyCollectors.add(new MainGroupPaketDependencyCollector(groupToDirectDependenciesMap.get(MAIN), this.paketIgnoredGroups));
                        } else {
                            paketDependencyCollectors.add(new GroupPaketDependencyCollector(groupToDirectDependenciesMap.get(groupName), this.paketIgnoredGroups, groupName));
                        }
                    }
                    logger.info("Start collecting paket dependencies");
                    paketDependencyCollectors.forEach(paketDependencyCollector -> {
                        Collection<AgentProjectInfo> prjectInfo = paketDependencyCollector.collectDependencies(topLevelFolder);
                        dependencies.addAll(prjectInfo.iterator().next().getDependencies());
                    });
                }

                // ignore all the nupkg files in order to not scan them again
                if (!dependencies.isEmpty()) {
                    if (this.ignoreSourceFiles) {
                        excludes.addAll(normalizeLocalPath(projectFolder, topLevelFolder,extensionPattern(PAKET_EXTENSIONS) , null));
                    } else {
                        excludes.addAll(normalizeLocalPath(projectFolder, topLevelFolder, extensionPattern(PAKET_EXTENSIONS), Constants.PACKAGES));
                    }
                }
            } else {
                logger.warn("Could not find paket.lock file in {}. Please execute 'paket install' first.", topLevelFolder);
            }
        } else {
            logger.warn("'paket install' command failed");
        }
        return new ResolutionResult(dependencies, excludes, getDependencyType(), topLevelFolder);
    }
50522
def dependencies_of(names)
      names = Array === names ? names.dup : names.to_a
      assert_strings!(names)

      deps = Set.new
      until names.empty?
        name = names.shift
        next if deps.include?(name)

        deps << name
        names.concat index[name].dependencies.map(&:name)
      end
      deps.to_a
    end
1267184
private void validateDepDefinitionUniqueness(final List<TriggerDependencyBean> dependencies) {
    for (int i = 0; i < dependencies.size(); i++) {
      for (int j = i + 1; j < dependencies.size(); j++) {
        final boolean duplicateDepDefFound =
            dependencies.get(i).getType().equals(dependencies.get(j)
                .getType()) && dependencies.get(i).getParams()
                .equals(dependencies.get(j).getParams());
        Preconditions.checkArgument(!duplicateDepDefFound, String.format("duplicate dependency"
                + "config %s found, dependency config should be unique",
            dependencies.get(i).getName()));
      }
    }
  }
613284
private void removeDependenciesWithoutSha1(Collection<DependencyInfo> dependencies){
        Collection<DependencyInfo> childDependencies = new ArrayList<>();
        for (Iterator<DependencyInfo> iterator = dependencies.iterator(); iterator.hasNext();){
            DependencyInfo dependencyInfo = iterator.next();
            if (dependencyInfo.getSha1().isEmpty()){
                childDependencies.addAll(dependencyInfo.getChildren());
                iterator.remove();
            }
        }
        dependencies.addAll(childDependencies);
    }
89932
private void buildDependencyTree()
        throws DependencyTreeBuilderException
    {
        if ( rootNode == null )
        {
            rootNode =
                dependencyTreeBuilder.buildDependencyTree( project, localRepository, artifactFactory,
                                                           artifactMetadataSource, null, artifactCollector );
        }
    }