void (@NotNull final CompileDependenciesProvider compileDependenciesProvider, @NotNull final RuntimeDependenciesProvider runtimeDependenciesProvider, @NotNull final AbstractExternalDependency dep) { Collection<File> resolvedFiles = getFiles(dep); boolean checkCompileOnlyDeps = compileDependenciesProvider.getCompileClasspathConfiguration() != null; // since version 3.4 compileOnly no longer extends compile // so, we can use compileOnly configuration for the check if (isJavaLibraryPluginSupported) { final Set<File> compileOnlyConfigurationFiles = compileDependenciesProvider.getCompileOnlyConfigurationFiles(); if (compileOnlyConfigurationFiles != null && compileOnlyConfigurationFiles.containsAll(resolvedFiles)) { // deprecated 'compile' configuration still can be used final Set<File> deprecatedCompileConfigurationFiles = compileDependenciesProvider.getDeprecatedCompileConfigurationFiles(); if (deprecatedCompileConfigurationFiles == null || !deprecatedCompileConfigurationFiles.containsAll(resolvedFiles)) { dep.setScope(PROVIDED_SCOPE); } } } else { if (checkCompileOnlyDeps && !compileDependenciesProvider.getCompileConfigurationFiles().containsAll(resolvedFiles) && !runtimeDependenciesProvider.getConfigurationFiles().containsAll(resolvedFiles)) { dep.setScope(PROVIDED_SCOPE); } } }