ExternalDepsResolutionResult () { final Collection<ExternalDependency> extDependencies = new LinkedHashSet<>(); Class<? extends Component> jvmLibrary = tryLoadingJvmLibraryClass(); if (jvmLibrary == null) { return ExternalDepsResolutionResult.EMPTY; } LenientConfiguration lenientConfiguration = myConfiguration.getResolvedConfiguration().getLenientConfiguration(); Set<UnresolvedDependency> unresolvedModuleDependencies = lenientConfiguration.getUnresolvedModuleDependencies(); Set<ResolvedArtifact> resolvedArtifacts; if(unresolvedModuleDependencies.isEmpty() || !is31OrBetter) { resolvedArtifacts = lenientConfiguration.getArtifacts(Specs.SATISFIES_ALL); } else { resolvedArtifacts = new LinkedHashSet<>(); // org.gradle.api.artifacts.LenientConfiguration.getAllModuleDependencies method was added in Gradle 3.1 Set<ResolvedDependency> allModuleDependencies = lenientConfiguration.getAllModuleDependencies(); for (ResolvedDependency dependency : allModuleDependencies) { try { resolvedArtifacts.addAll(dependency.getModuleArtifacts()); } catch (Exception ignore) { // ignore org.gradle.internal.resolve.ArtifactResolveException } } } final Multimap<ModuleVersionIdentifier, ResolvedArtifact> artifactMap = groupByModuleVersionId(resolvedArtifacts); final Map<ComponentIdentifier, ComponentArtifactsResult> auxiliaryArtifactsMap = buildAuxiliaryArtifactsMap(jvmLibrary, resolvedArtifacts); final Multimap<ModuleComponentIdentifier, ProjectDependency> configurationProjectDependencies = DeprecatedDependencyResolver.collectProjectDeps(myConfiguration); if(!myConfiguration.getResolvedConfiguration().hasError()) { extDependencies.addAll(buildFileCollectionDeps(resolvedArtifacts, configurationProjectDependencies.values())); } DependencyResultsTransformer dependencyResultsTransformer = new DependencyResultsTransformer( myContext, myProject, artifactMap, auxiliaryArtifactsMap, configurationProjectDependencies, myScope); ResolutionResult resolutionResult = myConfiguration.getIncoming().getResolutionResult(); extDependencies.addAll(dependencyResultsTransformer.buildExternalDependencies(resolutionResult.getRoot().getDependencies())); return new ExternalDepsResolutionResult(extDependencies, new ArrayList<>(dependencyResultsTransformer.getResolvedDepsFiles())); }