if (StringUtils.isEmpty(repositoryId)) {
// return MoxieCache
cache = getBuild().getSolver().getMoxieCache();
} else {
// get repository by identifier
Repository repository = getBuild().getConfig().getRepository(repositoryId);
if (repository == null) {
throw new MoxieException("Failed to find repositoryId: {0}", repositoryId);
}
if (isSnapshot && !repository.allowSnapshots()) {
if (allowSnapshots) {
getConsole().warn("Repository \"{0}\" prohibits snapshots! Overridden by \"allowSnapshots\" attribute!", repository.toString());
} else {
throw new MoxieException("Repository \"{0}\" prohibits installation or deployment of snapshots!",
repository.toString(), repository.getRepositoryUrl());
}
}
String url = repository.getRepositoryUrl();
if (url.startsWith("file:/")) {
try {
URI uri = new URI(url);
baseDir = new File(uri);
cache = new MavenCache(baseDir);