private @NotNull Collection<? extends ExternalDependency> resolveSourceSetProvidedDependencies(
    @NotNull SourceSet sourceSet,
    @NotNull Collection<? extends ExternalDependency> resolvedDependencies
  ) {
    Collection<Configuration> providedConfigurations = new LinkedHashSet<>();
    if (sourceSet.getName().equals("main") && myProject.getPlugins().findPlugin(WarPlugin.class) != null) {
      Configuration providedCompile = myProject.getConfigurations().findByName("providedCompile");
      if (providedCompile != null) {
        providedConfigurations.add(providedCompile);
      }
      Configuration providedRuntime = myProject.getConfigurations().findByName("providedRuntime");
      if (providedRuntime != null) {
        providedConfigurations.add(providedRuntime);
      }
    }
    if (providedConfigurations.isEmpty()) {
      return Collections.emptyList();
    }

    Multimap<Object, ExternalDependency> dependencyFileIndex = ArrayListMultimap.create();
    for (ExternalDependency dependency : resolvedDependencies) {
      dependencyFileIndex.put(getFiles(dependency), dependency);
    }

    Collection<ExternalDependency> result = new LinkedHashSet<>();
    for (Configuration configuration : providedConfigurations) {
      Collection<ExternalDependency> providedDependencies = resolveDependencies(configuration, PROVIDED_SCOPE);
      for (Iterator<ExternalDependency> iterator = providedDependencies.iterator(); iterator.hasNext(); ) {
        ExternalDependency providedDependency = iterator.next();
        Collection<File> files = getFiles(providedDependency);
        Collection<ExternalDependency> dependencies = dependencyFileIndex.get(files);
        if (!dependencies.isEmpty()) {
          for (ExternalDependency dependency : dependencies) {
            ((AbstractExternalDependency)dependency).setScope(PROVIDED_SCOPE);
          }
          iterator.remove();
        }
      }
      result.addAll(providedDependencies);
    }
    return result;
  }
private @NotNull Collection<? extends ExternalDependency> resolveSourceSetProvidedDependencies(
    @NotNull SourceSet sourceSet,
    @NotNull Collection<? extends ExternalDependency> resolvedDependencies
  )