Set<ExternalDependency> (Collection<Dependency> dependencies, String scope) { Set<ExternalDependency> result = new LinkedHashSet<>(); for (Dependency dep : dependencies) { try { if (dep instanceof SelfResolvingDependency && !(dep instanceof ProjectDependency)) { Set<File> files = ((SelfResolvingDependency)dep).resolve(); if (!files.isEmpty()) { AbstractExternalDependency dependency = new DefaultFileCollectionDependency(files); dependency.setScope(scope); result.add(dependency); } } } catch (Exception e) { // ignore } } return result; }