Collects dependencies, including transitives.
Project dependencies retain their scope, while test only dependencies (including transitives) will have test scope.
@param projectDependencies
@return
427702
private Set<Artifact> getDependencies(final Set<Artifact> projectDependencies) {
        Set<Artifact> result = new LinkedHashSet<Artifact>(projectDependencies);
        Set<Artifact> testDependencies = dependenciesWithScope(projectDependencies, Artifact.SCOPE_TEST);
        Set<Artifact> nonTestDependencies = allBut(projectDependencies, testDependencies);

        Set<Artifact> testTransitives = resolve(testDependencies);
        Set<Artifact> nonTestTransitives = resolve(nonTestDependencies);

        Set<Artifact> testOnlyDependencies = allBut(testTransitives, nonTestTransitives);

        for (Artifact testOnly : testOnlyDependencies) {
            result.add(new DefaultArtifact(testOnly.getGroupId(), testOnly.getArtifactId(), testOnly.getVersion(), Artifact.SCOPE_TEST, testOnly.getType(), testOnly.getClassifier(), testOnly
                    .getArtifactHandler()));
        }

        result.addAll(resolve(projectDependencies));
        return result;
    }
163949
public Set<SourceFile> getDependencies() {

		Set<SourceFile> sourceFiles = new TreeSet<SourceFile>();

		// Include all of the standard dependencies.
		for (Template t : dependencies.values()) {
			sourceFiles.add(t.sourceFile);
		}

		// Add the files that were looked-up but not found as well as the files
		// included via the file_contents() function.
		sourceFiles.addAll(otherDependencies);

		return Collections.unmodifiableSet(sourceFiles);
	}
280426
public void setDependencies(java.util.Collection<ApplicationDependencySummary> dependencies) {
        if (dependencies == null) {
            this.dependencies = null;
            return;
        }

        this.dependencies = new java.util.ArrayList<ApplicationDependencySummary>(dependencies);
    }
138184
public static boolean ensureMavenDependencyAdded(Project project, DependencyInstaller dependencyInstaller, String groupId, String artifactId, String scope) {
        List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
        for (Dependency d : dependencies) {
            if (groupId.equals(d.getCoordinate().getGroupId()) && artifactId.equals(d.getCoordinate().getArtifactId())) {
                getLOG().debug("Project already includes:  " + groupId + ":" + artifactId + " for version: " + d.getCoordinate().getVersion());
                return false;
            }
        }

        DependencyBuilder component = DependencyBuilder.create().
                setGroupId(groupId).
                setArtifactId(artifactId);

        if (scope != null) {
            component.setScopeType(scope);
        }

        String version = MavenHelpers.getVersion(groupId, artifactId);
        if (Strings.isNotBlank(version)) {
            component = component.setVersion(version);
            getLOG().debug("Adding pom.xml dependency:  " + groupId + ":" + artifactId + " version: " + version + " scope: " + scope);
        } else {
            getLOG().debug("No version could be found for:  " + groupId + ":" + artifactId);
        }
        dependencyInstaller.install(project, component);
        return true;
    }
655912
public void addDependencies( String pomPath ) throws ProjectException {
        addDependencies( new Project(pomPath, getLocalRepoPath(), getRemoteRepositories()), null );
    }
1206458
public static List<Dependency> getAllDependencies(final Module module) {
        final Set<Dependency> dependencies = new HashSet<Dependency>();
        final List<String> producedArtifacts = new ArrayList<String>();
        for(final Artifact artifact: getAllArtifacts(module)){
            producedArtifacts.add(artifact.getGavc());
        }

        dependencies.addAll(getAllDependencies(module, producedArtifacts));

        return new ArrayList<Dependency>(dependencies);
    }
642328
def dependencies( scopes = nil)
      if scopes
        unless scopes.is_a? Array
           scopes = [scopes]
        end
      end
          
      if Naether.platform == 'java'
        if scopes.nil?
          deps = @project.getDependenciesNotation()
        else
          deps = @project.getDependenciesNotation( scopes )
        end
        
      elsif scopes
        list = Naether::Java.convert_to_java_list( scopes )

        deps = @project._invoke('getDependenciesNotation', 'Ljava.util.List;', list)
      else
        deps = @project.getDependenciesNotation()
      end

      
      Naether::Java.convert_to_ruby_array( deps, true )
    end
627998
@Override
    protected ResolutionResult resolveDependencies(String projectFolder, String topLevelFolder, Set<String> configFiles) {
        if (this.nugetConfigFileType == NugetConfigFileType.CONFIG_FILE_TYPE && this.runPreStep) {
            logger.debug("Trying to run pre step on packages.config files");
            NugetRestoreCollector nugetRestoreCollector = new NugetRestoreCollector();
            nugetRestoreCollector.executeRestore(projectFolder, configFiles);
            Collection<AgentProjectInfo> projects = nugetRestoreCollector.collectDependencies(projectFolder);
            Collection<DependencyInfo> dependencies = projects.stream().flatMap(project -> project.getDependencies().stream()).collect(Collectors.toList());
            return new ResolutionResult(dependencies, getExcludes(), getDependencyType(), topLevelFolder);
        } else {
            return getResolutionResultFromParsing(topLevelFolder, configFiles, false);
        }
    }
564252
@Override
   public boolean dependsOnAddon(final Project project, AddonId addonId)
   {
      DependencyInstaller dependencyInstaller = getDependencyInstaller();
      Dependency dependency = toDependency(addonId);
      return dependencyInstaller.isInstalled(project, dependency);
   }
1161004
private Map<String, Map<String, Set<String>>> getDependencies(Context context,
                                                                  Collection<JavaFileObject> explicitJFOs,
                                                                  boolean cp) {
        Map<String, Map<String, Set<String>>> result = new HashMap<>();

        for (CompletionNode cnode : getDependencyNodes(context, explicitJFOs, true)) {

            String fqDep = cnode.getClassSymbol().outermostClass().flatname.toString();
            String depPkg = Util.pkgNameOfClassName(fqDep);

            Map<String, Set<String>> depsForThisClass = result.get(depPkg);
            if (depsForThisClass == null) {
                result.put(depPkg, depsForThisClass = new HashMap<>());
            }

            Set<String> fqDeps = depsForThisClass.get(fqDep);
            if (fqDeps == null) {
                depsForThisClass.put(fqDep, fqDeps = new HashSet<>());
            }

            for (Node<?,?> depNode : getAllDependencies(cnode)) {
                CompletionNode cDepNode = (CompletionNode) depNode;
                // Symbol is not regarded to depend on itself.
                if (cDepNode == cnode) {
                    continue;
                }
                // Skip anonymous classes
                if (cDepNode.getClassSymbol().fullname == null) {
                    continue;
                }
                if (isSymbolRelevant(cp, cDepNode.getClassSymbol())) {
                    fqDeps.add(cDepNode.getClassSymbol().outermostClass().flatname.toString());
                }
            }

            // The completion dependency graph is not transitively closed for inheritance relations.
            // For sjavac's purposes however, a class depends on it's super super type, so below we
            // make sure that we include super types.
            for (ClassSymbol cs : allSupertypes(cnode.getClassSymbol())) {
                if (isSymbolRelevant(cp, cs)) {
                    fqDeps.add(cs.outermostClass().flatname.toString());
                }
            }

        }
        return result;
    }
1352587
protected void getDependencies(JSONObject jsonObject, String rootDirectory, Collection<DependencyInfo> dependencies) {
        try {
            CommandLineProcess npmLs = new CommandLineProcess(rootDirectory, getLsCommandParams());
            npmLs.setTimeoutReadLineSeconds(this.npmTimeoutDependenciesCollector);
            List<String> linesOfNpmLs = npmLs.executeProcess();
            getDependencies(jsonObject, linesOfNpmLs, 1, dependencies);
        } catch (IOException e) {
            logger.warn("Error getting dependencies after running 'npm ls --json' on {}, error : {}", rootDirectory, e.getMessage());
            logger.debug("Error: {}", e.getStackTrace());
        }
    }
473504
private static void addDependency(List<Dependency> dependencies, MavenCoordinates requiredArtifact, Constants.ArtifactType type, String scope) {
		Dependency dependency = new Dependency();
		dependency.setGroupId(requiredArtifact.getGroupId());
		dependency.setArtifactId(requiredArtifact.getArtifactId());
		dependency.setVersion(requiredArtifact.getVersion());

		if(scope!=null){
			dependency.setScope(scope);
		}
		if (type != null) {
			dependency.setType(type.getType());
		}
		dependencies.add(dependency);
	}
1336353
public List<LibraryDescriptor.Dependency> getAllDependenciesAnyScope() {
		ArrayList<LibraryDescriptor.Dependency> list = new ArrayList<>(dependencies.size());
		list.addAll(dependencies);
		return list;
	}
346409
public Set<DependencyInfo> parsePackagesConfigFile(boolean getDependenciesFromReferenceTag, String nugetDependencyFile) {
        Persister persister = new Persister();
        Set<DependencyInfo> dependencies = new HashSet<>();
        try {
            // case of packages.config file
            if (this.nugetConfigFileType == NugetConfigFileType.CONFIG_FILE_TYPE) {
                NugetPackages packages = persister.read(NugetPackages.class, xml);
                if (!getDependenciesFromReferenceTag) {
                    dependencies.addAll(collectDependenciesFromNugetConfig(packages, nugetDependencyFile));
                }
                // case of csproj file
            } else {
                NugetCsprojPackages csprojPackages = persister.read(NugetCsprojPackages.class, xml);
                NugetPackages packages = getNugetPackagesFromCsproj(csprojPackages);
                if (!getDependenciesFromReferenceTag) {
                    dependencies.addAll(collectDependenciesFromNugetConfig(packages, nugetDependencyFile));
                }
                dependencies.addAll(getDependenciesFromReferencesTag(csprojPackages));
            }
            dependencies.stream().forEach(dependencyInfo -> dependencyInfo.setSystemPath(this.xml.getPath()));
        } catch (Exception e) {
            logger.warn("Unable to parse suspected Nuget package configuration file {}", xml, e.getMessage());
        }
        return dependencies;
    }
248363
@Override
    public Collection<AgentProjectInfo> collectDependencies(String rootDirectory) {
        Collection<DependencyInfo> dependencies = new LinkedList<>();
        Map<File, Collection<String>> folderMapToFiles = new FilesUtils().fillFilesMap(this.tempPathToPackagesFile.keySet(), this.includes,
                this.excludes,true, false);
        for (File file : folderMapToFiles.keySet()) {
            for (String shortPath : folderMapToFiles.get(file)) {
                String nugetFilePath = file.getAbsolutePath() + BACK_SLASH + shortPath;
                DependencyInfo dependency = getDependency(nugetFilePath, this.tempPathToPackagesFile.get(file.getPath()));
                dependencies.add(dependency);
            }
        }
        deleteDirectories();
        logger.debug("Finish deleting directories of {} {}", this.command, RESTORE);
        return getSingleProjectList(dependencies);
    }
255274
public void addDependencies( String pomPath, List<String> scopes ) throws ProjectException {
        addDependencies( new Project( pomPath), scopes );
    }
91372
public static ProjectDependencies load(File basedir) throws IOException {
        return mapper.reader(ProjectDependencies.class)
                .readValue(new File(basedir, Constants.DEPENDENCIES_FILE));
    }