use of org.apache.ivy.plugins.repository.Repository in project ant-ivy by apache.
the class ChainedRepository method get.
public void get(String source, File destination) throws IOException {
for (Repository repository : repositories) {
logTry(repository);
boolean ok = false;
try {
repository.get(source, destination);
ok = true;
} catch (Exception e) {
logFailed(repository, e);
}
if (ok) {
logSuccess(repository);
return;
}
}
throw newIOEFail("copy " + source + " into " + destination);
}
use of org.apache.ivy.plugins.repository.Repository 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