use of org.apache.ivy.osgi.repo.RelativeURLRepository in project ant-ivy by apache.
the class MirroredURLResolver method setupMirrors.
private void setupMirrors() {
File mirrorListFile = downloadMirrorList();
List<String> mirrorBaseUrls;
try {
mirrorBaseUrls = readMirrorList(mirrorListFile);
} catch (IOException e) {
throw new IllegalStateException("The mirror list could not be read from " + mirrorListUrl + " (" + e.getMessage() + ")");
}
List<Repository> repositories = new ArrayList<>();
for (String baseUrl : mirrorBaseUrls) {
URL url = null;
try {
url = new URL(baseUrl);
} catch (MalformedURLException e) {
Message.warn("In the mirror list from " + mirrorListUrl + ", an incorrect url has been found and will then not be used: " + baseUrl);
}
if (url != null) {
final RelativeURLRepository repo = new RelativeURLRepository(url, this.getTimeoutConstraint());
repositories.add(repo);
}
}
((ChainedRepository) getRepository()).setRepositories(repositories);
}
Aggregations