use of aQute.maven.provider.MavenRepository in project bnd by bndtools.
the class PomRepositoryTest method getRepo.
MavenRepository getRepo() throws Exception {
List<MavenBackingRepository> central = MavenBackingRepository.create("https://repo1.maven.org/maven2/", reporter, localRepo, client);
List<MavenBackingRepository> apache = MavenBackingRepository.create("https://repository.apache.org/content/groups/snapshots/", reporter, localRepo, client);
MavenRepository mr = new MavenRepository(localRepo, "test", central, apache, Processor.getExecutor(), reporter, null);
return mr;
}
use of aQute.maven.provider.MavenRepository in project bnd by bndtools.
the class PomRepositoryTest method testRepository.
public void testRepository() throws Exception {
MavenRepository repo = getRepo();
Revision revision = Revision.valueOf("bcel:bcel:5.1");
PomRepository pom = new PomRepository(repo, client, location).revisions(Collections.singleton(revision));
assertTrue(location.isFile());
try (XMLResourceParser xp = new XMLResourceParser(location)) {
List<Resource> parse = xp.parse();
assertEquals(parse.size(), pom.getResources().size());
}
}
use of aQute.maven.provider.MavenRepository in project bnd by bndtools.
the class MavenBndRepository method init.
private synchronized void init() {
try {
if (inited)
return;
client = registry.getPlugin(HttpClient.class);
inited = true;
name = configuration.name("Maven");
localRepo = IO.getFile(configuration.local(MAVEN_REPO_LOCAL));
List<MavenBackingRepository> release = MavenBackingRepository.create(configuration.releaseUrl(), reporter, localRepo, client);
List<MavenBackingRepository> snapshot = MavenBackingRepository.create(configuration.snapshotUrl(), reporter, localRepo, client);
storage = new MavenRepository(localRepo, getName(), release, snapshot, Processor.getExecutor(), reporter, getRefreshCallback());
File base = IO.work;
if (registry != null) {
Workspace ws = registry.getPlugin(Workspace.class);
if (ws != null)
base = ws.getBuildDir();
}
File indexFile = IO.getFile(base, configuration.index(name.toLowerCase() + ".mvn"));
IndexFile ixf = new IndexFile(reporter, indexFile, storage);
ixf.open();
this.index = ixf;
startPoll(index);
logger.debug("initing {}", this);
} catch (Exception e) {
reporter.exception(e, "Init for maven repo failed %s", configuration);
throw new RuntimeException(e);
}
}
use of aQute.maven.provider.MavenRepository in project bnd by bndtools.
the class BndPomRepository method init.
public synchronized void init() {
try {
if (inited)
return;
inited = true;
Workspace workspace = registry.getPlugin(Workspace.class);
HttpClient client = registry.getPlugin(HttpClient.class);
File localRepo = IO.getFile(configuration.local(MAVEN_REPO_LOCAL));
File location = workspace.getFile(getLocation());
List<MavenBackingRepository> release = MavenBackingRepository.create(configuration.releaseUrls(), reporter, localRepo, client);
List<MavenBackingRepository> snapshot = MavenBackingRepository.create(configuration.snapshotUrls(), reporter, localRepo, client);
MavenRepository repository = new MavenRepository(localRepo, name, release, snapshot, Processor.getExecutor(), reporter, null);
boolean transitive = configuration.transitive(true);
if (pomFiles != null) {
repoImpl = new PomRepository(repository, client, location, transitive).uris(pomFiles);
} else if (revisions != null) {
repoImpl = new PomRepository(repository, client, location, transitive).revisions(revisions);
} else if (query != null) {
repoImpl = new SearchRepository(repository, location, query, queryUrl, workspace, client, transitive);
} else {
repository.close();
throw new IllegalStateException("We have neither a pom, revision, or query set!");
}
bridge = new BridgeRepository(repoImpl);
} catch (Exception e) {
throw Exceptions.duck(e);
}
}
use of aQute.maven.provider.MavenRepository in project bnd by bndtools.
the class PomRepositoryTest method testPomTransitive.
public void testPomTransitive() throws Exception {
MavenRepository mr = getRepo();
Revision revision = Program.valueOf("org.apache.aries.blueprint", "org.apache.aries.blueprint.cm").version("1.0.8");
Traverser t = new Traverser(mr, new HttpClient(), Processor.getExecutor(), true).revision(revision);
Map<Archive, Resource> value = t.getResources().getValue();
assertEquals(8, value.size());
assertAllBndCap(value);
}
Aggregations