Search in sources :

Example 6 with Program

use of aQute.maven.api.Program in project bnd by bndtools.

the class Traverser method parsePom.

private void parsePom(POM pom, String parent) throws Exception {
    Map<Program, Dependency> dependencies = pom.getDependencies(EnumSet.of(MavenScope.compile, MavenScope.runtime), false);
    for (Dependency d : dependencies.values()) {
        d.bindToVersion(repo);
        Archive archive = d.getArchive();
        if (archive == null) {
            logger.debug("pom {} has bad dependency {}", pom.getRevision(), d);
        } else
            parse(archive, parent);
    }
}
Also used : Program(aQute.maven.api.Program) Archive(aQute.maven.api.Archive) Dependency(aQute.maven.api.IPom.Dependency)

Example 7 with Program

use of aQute.maven.api.Program in project bnd by bndtools.

the class MavenRepoTest method testBasicSnapshotRelease.

public void testBasicSnapshotRelease() throws Exception {
    File fpom = IO.getFile(local, "commons-cli/commons-cli/1.4-SNAPSHOT/commons-cli-1.4-SNAPSHOT.pom");
    File rpom = IO.getFile(remote, "commons-cli/commons-cli/1.4-SNAPSHOT/commons-cli-1.4-19700101.000010-10.pom");
    Program program = Program.valueOf("commons-cli", "commons-cli");
    Revision revision = Program.valueOf("commons-cli", "commons-cli").version("1.4-SNAPSHOT");
    Archive apom = revision.archive("pom", null);
    assertFalse(fpom.exists());
    Release r = storage.release(revision, new Properties());
    r.setBuild(10000, null);
    r.add("pom", null, new ByteArrayInputStream(new byte[0]));
    r.close();
    assertTrue(fpom.isFile());
    assertTrue(rpom.isFile());
}
Also used : Program(aQute.maven.api.Program) Archive(aQute.maven.api.Archive) Revision(aQute.maven.api.Revision) ByteArrayInputStream(java.io.ByteArrayInputStream) Properties(java.util.Properties) File(java.io.File) Release(aQute.maven.api.Release)

Example 8 with Program

use of aQute.maven.api.Program in project bnd by bndtools.

the class MavenRepoTest method testImmutable.

public void testImmutable() throws Exception {
    File fpom = IO.getFile(local, "commons-cli/commons-cli/1.2/commons-cli-1.2.pom");
    Program program = Program.valueOf("commons-cli", "commons-cli");
    Revision revision = Program.valueOf("commons-cli", "commons-cli").version("1.2");
    Archive apom = revision.archive("pom", null);
    assertFalse(fpom.exists());
    Archive rapom = storage.resolveSnapshot(apom);
    assertTrue(rapom.isResolved());
    assertEquals(rapom, apom);
    File f = storage.get(rapom).getValue();
    assertEquals(fpom, f);
    assertRecent(f);
    f.setLastModified(10000);
    f = storage.get(rapom).getValue();
    assertEquals(fpom, f);
    assertEquals(10000L, f.lastModified());
}
Also used : Program(aQute.maven.api.Program) Archive(aQute.maven.api.Archive) Revision(aQute.maven.api.Revision) File(java.io.File)

Aggregations

Program (aQute.maven.api.Program)8 Archive (aQute.maven.api.Archive)5 Revision (aQute.maven.api.Revision)5 File (java.io.File)4 Dependency (aQute.maven.api.IPom.Dependency)2 BundleDescriptor (aQute.bnd.repository.maven.provider.IndexFile.BundleDescriptor)1 MavenVersion (aQute.bnd.version.MavenVersion)1 IPom (aQute.maven.api.IPom)1 Release (aQute.maven.api.Release)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Properties (java.util.Properties)1