use of io.fabric8.maven.util.MavenRepositoryURL in project fabric8 by jboss-fuse.
the class AetherBasedResolver method selectRepositories.
private List<RemoteRepository> selectRepositories() {
List<RemoteRepository> list = new ArrayList<RemoteRepository>();
List<MavenRepositoryURL> urls = Collections.emptyList();
try {
urls = m_config.getRepositories();
} catch (MalformedURLException exc) {
LOG.error("invalid repository URLs", exc);
}
for (MavenRepositoryURL r : urls) {
if (r.isMulti()) {
addSubDirs(list, r.getFile());
} else {
addRepo(list, r);
}
}
return list;
}
use of io.fabric8.maven.util.MavenRepositoryURL in project fabric8 by jboss-fuse.
the class AetherBasedResolver method addLocalSubDirs.
private void addLocalSubDirs(List<LocalRepository> list, File parentDir) {
if (!parentDir.isDirectory()) {
LOG.debug("Repository marked with @multi does not resolve to a directory: " + parentDir);
return;
}
for (File repo : parentDir.listFiles()) {
if (repo.isDirectory()) {
try {
String repoURI = repo.toURI().toString() + "@id=" + repo.getName();
LOG.debug("Adding repo from inside multi dir: " + repoURI);
addLocalRepo(list, new MavenRepositoryURL(repoURI));
} catch (MalformedURLException e) {
LOG.error("Error resolving repo url of a multi repo " + repo.toURI());
}
}
}
}
use of io.fabric8.maven.util.MavenRepositoryURL in project fabric8 by jboss-fuse.
the class AetherBasedResolver method selectDefaultRepositories.
List<LocalRepository> selectDefaultRepositories() {
List<LocalRepository> list = new ArrayList<LocalRepository>();
List<MavenRepositoryURL> urls = Collections.emptyList();
try {
urls = m_config.getDefaultRepositories();
} catch (MalformedURLException exc) {
LOG.error("invalid repository URLs", exc);
}
for (MavenRepositoryURL r : urls) {
if (r.isMulti()) {
addLocalSubDirs(list, r.getFile());
} else {
addLocalRepo(list, r);
}
}
return list;
}
use of io.fabric8.maven.util.MavenRepositoryURL in project fabric8 by jboss-fuse.
the class MavenRepositoryURLTest method testSimpleSpec.
@Test
public void testSimpleSpec() throws MalformedURLException {
String spec = "http://repo1.maven.org/maven2";
MavenRepositoryURL repo = new MavenRepositoryURL(spec);
Assert.assertTrue(repo.isReleasesEnabled());
Assert.assertFalse(repo.isSnapshotsEnabled());
Assert.assertEquals("repo_" + String.valueOf("http://repo1.maven.org/maven2/".hashCode()), repo.getId());
}
use of io.fabric8.maven.util.MavenRepositoryURL in project fabric8 by jboss-fuse.
the class MavenRepositoryURLTest method testSpecWithSnapshotsAndId.
@Test
public void testSpecWithSnapshotsAndId() throws MalformedURLException {
String spec = "http://repo1.maven.org/maven2@snapshots@id=central";
MavenRepositoryURL repo = new MavenRepositoryURL(spec);
Assert.assertTrue(repo.isReleasesEnabled());
Assert.assertTrue(repo.isSnapshotsEnabled());
Assert.assertEquals("central", repo.getId());
spec = "http://repo1.maven.org/maven2@id=central@snapshots";
repo = new MavenRepositoryURL(spec);
Assert.assertTrue(repo.isReleasesEnabled());
Assert.assertTrue(repo.isSnapshotsEnabled());
Assert.assertEquals("central", repo.getId());
}
Aggregations