use of aQute.maven.provider.MavenBackingRepository 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.MavenBackingRepository 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.MavenBackingRepository in project bnd by bndtools.
the class MavenBndRepository method tooltip.
@Override
public String tooltip(Object... target) throws Exception {
switch(target.length) {
case 0:
try (Formatter f = new Formatter()) {
f.format("%s\n", getName());
f.format("Revisions %s\n", index.descriptors.size());
for (MavenBackingRepository mbr : storage.getReleaseRepositories()) f.format("Release %s (%s)\n", mbr, getUser(mbr));
for (MavenBackingRepository mbr : storage.getSnapshotRepositories()) f.format("Snapshot %s (%s)\n", mbr, getUser(mbr));
f.format("Storage %s\n", localRepo);
f.format("Index %s\n", index.indexFile);
f.format("Index Cache %s\n", index.cacheDir);
return f.toString();
}
case 1:
try (Formatter f = new Formatter()) {
String name = (String) target[0];
Set<aQute.maven.api.Program> programs = index.getProgramsForBsn(name);
return programs.toString();
}
case 2:
BundleDescriptor bd = getBundleDescriptor(target);
try (Formatter f = new Formatter()) {
f.format("%s\n", bd.archive);
f.format("Bundle-Version %s\n", bd.version);
f.format("Last Modified %s\n", new Date(bd.lastModified));
f.format("URL %s\n", bd.url);
f.format("SHA-1 %s\n", Hex.toHexString(bd.id).toLowerCase());
f.format("SHA-256 %s\n", Hex.toHexString(bd.sha256).toLowerCase());
File localFile = storage.toLocalFile(bd.archive);
f.format("Local %s%s\n", localFile, localFile.isFile() ? "" : " ?");
if (bd.description != null)
f.format("Description\n%s", bd.description);
return f.toString();
}
default:
}
return null;
}
use of aQute.maven.provider.MavenBackingRepository 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);
}
}
Aggregations