public DependencyLink find(Dependency dependency) {
String path = null;
for (String repository : localRepositories) {
File cacheRoot = new File(localArtifactsRoot, repository);
IMavenCache cache = new MavenCache(cacheRoot);
File file = cache.getArtifact(dependency, dependency.extension);
if (file != null && file.exists()) {
path = repository + "/" + FileUtils.getRelativePath(cacheRoot, file.getParentFile());
}
}
for (RemoteRepository repository : remoteRepositories) {
String folder = StringUtils.urlToFolder(repository.url);
File cacheRoot = new File(remoteArtifactsRoot, folder);
IMavenCache cache = new MavenCache(cacheRoot);
File file = cache.getArtifact(dependency, dependency.extension);
if (file != null && file.exists()) {
path = repository.id + "/" + FileUtils.getRelativePath(cacheRoot, file.getParentFile());
}
}
if (StringUtils.isEmpty(path)) {