Search in sources :

Example 1 with MavenMetadataRebuildFacet

use of org.sonatype.nexus.repository.maven.MavenMetadataRebuildFacet in project nexus-public by sonatype.

the class DataStoreMavenTestHelper method read.

@Override
public Payload read(final Repository repository, final String path) throws IOException {
    MavenContentFacet mavenFacet = repository.facet(MavenContentFacet.class);
    Optional<MavenMetadataRebuildFacet> metadataRebuildFacet = repository.optionalFacet(MavenMetadataRebuildFacet.class);
    if (metadataRebuildFacet.isPresent()) {
        metadataRebuildFacet.get().maybeRebuildMavenMetadata(prependIfMissing(path, ASSET_PATH_PREFIX), false, true);
    }
    MavenPath mavenPath = mavenFacet.getMavenPathParser().parsePath(path);
    return mavenFacet.get(mavenPath).orElse(null);
}
Also used : MavenMetadataRebuildFacet(org.sonatype.nexus.repository.maven.MavenMetadataRebuildFacet) MavenPath(org.sonatype.nexus.repository.maven.MavenPath) MavenContentFacet(org.sonatype.nexus.content.maven.MavenContentFacet)

Example 2 with MavenMetadataRebuildFacet

use of org.sonatype.nexus.repository.maven.MavenMetadataRebuildFacet in project nexus-public by sonatype.

the class RebuildMaven2MetadataTask method execute.

@Override
protected void execute(final Repository repository) {
    MavenMetadataRebuildFacet mavenHostedFacet = repository.facet(MavenMetadataRebuildFacet.class);
    mavenHostedFacet.rebuildMetadata(getConfiguration().getString(GROUPID_FIELD_ID), getConfiguration().getString(ARTIFACTID_FIELD_ID), getConfiguration().getString(BASEVERSION_FIELD_ID), getConfiguration().getBoolean(REBUILD_CHECKSUMS, false), false);
}
Also used : MavenMetadataRebuildFacet(org.sonatype.nexus.repository.maven.MavenMetadataRebuildFacet)

Example 3 with MavenMetadataRebuildFacet

use of org.sonatype.nexus.repository.maven.MavenMetadataRebuildFacet in project nexus-public by sonatype.

the class MavenContentDirector method afterMove.

@Override
public void afterMove(final List<Map<String, String>> components, final Repository destination) {
    MavenMetadataRebuildFacet facet = destination.facet(MavenMetadataRebuildFacet.class);
    components.stream().map(component -> Pair.of(component.get("group"), component.get("name"))).distinct().forEach(pair -> facet.rebuildMetadata(pair.getLeft(), pair.getRight(), null, false));
}
Also used : MavenMetadataRebuildFacet(org.sonatype.nexus.repository.maven.MavenMetadataRebuildFacet)

Aggregations

MavenMetadataRebuildFacet (org.sonatype.nexus.repository.maven.MavenMetadataRebuildFacet)3 MavenContentFacet (org.sonatype.nexus.content.maven.MavenContentFacet)1 MavenPath (org.sonatype.nexus.repository.maven.MavenPath)1