Search in sources :

Example 1 with POM

use of aQute.maven.provider.POM in project bnd by bndtools.

the class MavenBndRepoTest method testPomGenerate.

public void testPomGenerate() throws Exception {
    config(null);
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    PomOptions po = new PomOptions();
    po.gav = "test:test:1.0";
    po.parent = null;
    po.dependencyManagement = false;
    repo.toPom(bout, po);
    ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
    POM pom = new POM((MavenRepository) repo.storage, bin);
    assertEquals(Revision.valueOf("test:test:1.0"), pom.getRevision());
    assertEquals(3, pom.getDependencies(EnumSet.of(MavenScope.runtime), false).size());
    System.out.println(new String(bout.toByteArray(), StandardCharsets.UTF_8));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) PomOptions(aQute.bnd.service.maven.PomOptions) POM(aQute.maven.provider.POM)

Example 2 with POM

use of aQute.maven.provider.POM in project bnd by bndtools.

the class Traverser method getResources.

Promise<Map<Archive, Resource>> getResources() throws Exception {
    /*
		 * We don't want to resolve until all the work is queued so we
		 * initialize the count to 1 and call finish after queuing all the work.
		 */
    if (count.compareAndSet(-1, 1)) {
        try {
            if (!uris.isEmpty()) {
                for (URI uri : uris) {
                    File in = client.build().useCache().age(1, TimeUnit.DAYS).go(uri);
                    POM pom = new POM(repo, in);
                    parsePom(pom, ROOT);
                }
            } else {
                for (Revision revision : revisions) parse(revision.archive("jar", null), ROOT);
            }
        } finally {
            finish();
        }
    }
    return deferred.getPromise();
}
Also used : Revision(aQute.maven.api.Revision) URI(java.net.URI) File(java.io.File) POM(aQute.maven.provider.POM)

Example 3 with POM

use of aQute.maven.provider.POM in project bnd by bndtools.

the class Traverser method parseArchive.

private void parseArchive(Archive archive) throws Exception {
    POM pom = repo.getPom(archive.getRevision());
    String parent = archive.getRevision().toString();
    if (pom == null) {
        logger.debug("no pom found for archive {} ", archive);
        if (!archive.isPom())
            parseResource(archive, parent);
        return;
    }
    parsePom(pom, parent);
    if (!pom.isPomOnly())
        parseResource(archive, parent);
}
Also used : POM(aQute.maven.provider.POM)

Aggregations

POM (aQute.maven.provider.POM)3 PomOptions (aQute.bnd.service.maven.PomOptions)1 Revision (aQute.maven.api.Revision)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 URI (java.net.URI)1