Collection<ExternalDependency> (@NotNull final SourceSet sourceSet) { if (!IS_NEW_DEPENDENCY_RESOLUTION_APPLICABLE) { //noinspection deprecation return new DeprecatedDependencyResolver(myContext, myProject, false, myDownloadJavadoc, myDownloadSources) .resolveDependencies(sourceSet); } Collection<ExternalDependency> result = new ArrayList<>(); // resolve compile dependencies FileCollection compileClasspath = getCompileClasspath(sourceSet); Collection<? extends ExternalDependency> compileDependencies = resolveDependenciesWithDefault( compileClasspath, COMPILE_SCOPE, new Supplier<Collection<? extends ExternalDependency>>() { @Override public Collection<? extends ExternalDependency> get() { String configurationName = sourceSet.getCompileClasspathConfigurationName(); Configuration configuration = myProject.getConfigurations().getByName(configurationName); return getDependencies(configuration, COMPILE_SCOPE); } } ); // resolve runtime dependencies FileCollection runtimeClasspath = sourceSet.getRuntimeClasspath(); Collection<? extends ExternalDependency> runtimeDependencies = resolveDependenciesWithDefault( runtimeClasspath, RUNTIME_SCOPE, new Supplier<Collection<? extends ExternalDependency>>() { @Override public Collection<? extends ExternalDependency> get() { String configurationName = sourceSet.getRuntimeClasspathConfigurationName(); Configuration configuration = myProject.getConfigurations().getByName(configurationName); return getDependencies(configuration, RUNTIME_SCOPE); } } ); filterRuntimeAndMarkCompileOnlyAsProvided(compileDependencies, runtimeDependencies); result.addAll(compileDependencies); result.addAll(runtimeDependencies); addAdditionalProvidedDependencies(sourceSet, result); int order = 0; for (ExternalDependency dependency : result) { ((AbstractExternalDependency)dependency).setClasspathOrder(++order); } return result; }