internal Dependency FindCandidate(string repoPath, Dependency dep)
{
string basePath = Path.Combine(dep.Group, dep.Artifact);
basePath = basePath.Replace(".", Path.DirectorySeparatorChar.ToString());
string metadataFile = Path.Combine(Path.Combine(repoPath, basePath), "maven-metadata.xml");
if (File.Exists(metadataFile))
{
ProcessMetadata(dep, metadataFile);
dep.RepoPath = repoPath;
}
else
{
return null;
}
while (dep.HasPossibleVersions)
{
// TODO(wilkinsonclay): get the packaging from the pom.
// Check for the actual file existing, otherwise skip this version.
foreach (string ext in Packaging)
{
string basename = dep.Artifact + "-" + dep.BestVersion + ext;
string fname = Path.Combine(dep.BestVersionPath, basename);
if (File.Exists(fname))
{
return dep;
}
}
Log(dep.Key + " version " + dep.BestVersion + " not available, ignoring.",
verbose: true);
dep.RemovePossibleVersion(dep.BestVersion);
}
return null;
}