// TODO: belongs in another utility classs public static bool downloadArtifactFromRemoteRepository(Artifact.Artifact artifact, string ext) { try { Dictionary <string, string> repos = SettingsUtil.GetSettingsRepositories(); foreach (string id in repos.Keys) { string url = repos[id]; ArtifactContext artifactContext = new ArtifactContext(); if (artifact.Version.Contains("SNAPSHOT")) { string newVersion = GetSnapshotVersion(artifact, url); if (newVersion != null) { artifact.RemotePath = artifactContext.GetArtifactRepository().GetRemoteRepositoryPath(artifact, artifact.Version.Replace("SNAPSHOT", newVersion), url, ext); } else { artifact.RemotePath = artifactContext.GetArtifactRepository().GetRemoteRepositoryPath(artifact, url, ext); } } else { artifact.RemotePath = artifactContext.GetArtifactRepository().GetRemoteRepositoryPath(artifact, url, ext); } if (downloadArtifact(artifact)) { return(true); } } return(false); } catch (Exception e) { log.Error("Cannot add reference of " + artifact.ArtifactId + ", an exception occurred trying to download it: " + e.Message); return(false); } }
private string getDefaultRepositoryUrl() { NPanday.Model.Settings.Repository repo = getRepositoryFromDefaultProfile(); return(repo != null ? repo.url : SettingsUtil.GetSettingsRepositories()["central"]); }