Search in sources :

Example 1 with SnapshotVersion

use of aQute.maven.provider.MetadataParser.SnapshotVersion in project bnd by bndtools.

the class SnapshotReleaser method updateMetadata.

public void updateMetadata() throws Exception {
    revisionMetadata.group = revision.group;
    revisionMetadata.artifact = revision.artifact;
    revisionMetadata.version = revision.version;
    revisionMetadata.lastUpdated = programMetadata.lastUpdated;
    revisionMetadata.snapshot.buildNumber = build;
    revisionMetadata.snapshot.timestamp = dateStamp;
    for (Archive archive : upload) {
        SnapshotVersion snapshotVersion = new SnapshotVersion();
        snapshotVersion.extension = archive.extension;
        snapshotVersion.classifier = archive.classifier.isEmpty() ? null : archive.classifier;
        snapshotVersion.updated = programMetadata.lastUpdated;
        snapshotVersion.value = this.snapshotVersion;
        revisionMetadata.snapshotVersions.add(snapshotVersion);
    }
    File metafile = home.toLocalFile(revision.metadata(repo.id));
    IO.mkdirs(metafile.getParentFile());
    IO.store(revisionMetadata.toString(), metafile);
    repo.store(metafile, revision.metadata());
    super.updateMetadata();
}
Also used : Archive(aQute.maven.api.Archive) SnapshotVersion(aQute.maven.provider.MetadataParser.SnapshotVersion) File(java.io.File)

Example 2 with SnapshotVersion

use of aQute.maven.provider.MetadataParser.SnapshotVersion in project bnd by bndtools.

the class MavenBackingRepository method getSnapshotArchives.

public List<Archive> getSnapshotArchives(Revision revision) throws Exception {
    RevisionMetadata metadata = getMetadata(revision);
    List<Archive> archives = new ArrayList<>();
    for (SnapshotVersion snapshotVersion : metadata.snapshotVersions) {
        Archive archive = revision.archive(snapshotVersion.value, snapshotVersion.extension, snapshotVersion.classifier);
        archives.add(archive);
    }
    return archives;
}
Also used : Archive(aQute.maven.api.Archive) SnapshotVersion(aQute.maven.provider.MetadataParser.SnapshotVersion) ArrayList(java.util.ArrayList) RevisionMetadata(aQute.maven.provider.MetadataParser.RevisionMetadata)

Example 3 with SnapshotVersion

use of aQute.maven.provider.MetadataParser.SnapshotVersion in project bnd by bndtools.

the class MetadataTest method testSnapshotParsing.

public void testSnapshotParsing() throws Exception {
    try (InputStream in = new FileInputStream(IO.getFile("testresources/parser/commons-dbcp-1.4.1-SNAPSHOT.xml"))) {
        RevisionMetadata parse = MetadataParser.parseRevisionMetadata(in);
        assertNotNull(parse);
        assertEquals("commons.dbcp", parse.group);
        assertEquals("commons-dbcp", parse.artifact);
        assertEquals(MavenVersion.parseString("1.4.1-SNAPSHOT"), parse.version);
        assertNotNull(parse.snapshot);
        assertEquals("13", parse.snapshot.buildNumber);
        assertEquals("20140107.141700", parse.snapshot.timestamp);
        assertEquals(10, parse.snapshotVersions.size());
        SnapshotVersion snapshotVersion = parse.snapshotVersions.get(0);
        assertNotNull(snapshotVersion);
        assertEquals("bin", snapshotVersion.classifier);
        assertEquals("tar.gz", snapshotVersion.extension);
        assertEquals(MavenVersion.parseString("1.4.1-20140107.141700-13"), snapshotVersion.value);
        assertEquals(1389104220000L, snapshotVersion.updated);
        snapshotVersion = parse.snapshotVersions.get(9);
        assertNotNull(snapshotVersion);
        assertNull(snapshotVersion.classifier);
        assertEquals("pom", snapshotVersion.extension);
        assertEquals(MavenVersion.parseString("1.4.1-20140107.141700-13"), snapshotVersion.value);
        assertEquals(1389104220000L, snapshotVersion.updated);
    }
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) SnapshotVersion(aQute.maven.provider.MetadataParser.SnapshotVersion) FileInputStream(java.io.FileInputStream) RevisionMetadata(aQute.maven.provider.MetadataParser.RevisionMetadata)

Aggregations

SnapshotVersion (aQute.maven.provider.MetadataParser.SnapshotVersion)3 Archive (aQute.maven.api.Archive)2 RevisionMetadata (aQute.maven.provider.MetadataParser.RevisionMetadata)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1