use of org.apache.maven.artifact.repository.metadata.Plugin in project indy by Commonjava.
the class PluginMarshaller method readFrom.
@Override
public Plugin readFrom(ProtoStreamReader reader) throws IOException {
Plugin plugin = new Plugin();
plugin.setArtifactId(reader.readString("artifactId"));
plugin.setName(reader.readString("name"));
plugin.setPrefix(reader.readString("prefix"));
return plugin;
}
use of org.apache.maven.artifact.repository.metadata.Plugin in project indy by Commonjava.
the class MavenMetadataGenerator method generateGroupMetadata.
/**
* Generate group related files (e.g maven-metadata.xml) from three levels.
* 1. cache, which means all the generation of the files will be cached. In terms of cache clearing, see #{@link MetadataMergeListener}
* 2. read cached from member hosted repos and try to download from member remote repos
* 3. generate by member hosted repos (list dir trying to find version directories)
*
* @param group
* @param members concrete store in group
* @param path
*/
private Metadata generateGroupMetadata(final Group group, final List<ArtifactStore> members, final List<StoreKey> contributingMembers, final String path) throws IndyWorkflowException {
if (!canProcess(path)) {
logger.error("The path is not a metadata file: {} ", path);
return null;
}
String toMergePath = path;
if (!path.endsWith(MavenMetadataMerger.METADATA_NAME)) {
toMergePath = normalize(normalize(parentPath(toMergePath)), MavenMetadataMerger.METADATA_NAME);
}
Metadata meta = getMetaFromCache(group.getKey(), toMergePath);
if (meta != null) {
return meta;
}
Metadata master = new Metadata();
master.setVersioning(new Versioning());
MetadataIncrementalResult incrementalResult = new MetadataIncrementalResult(new HashSet<>(members), Collections.emptySet(), master);
incrementalResult = mergeMissing(group, incrementalResult, toMergePath, "cached", this::retrieveCached);
contributingMembers.addAll(incrementalResult.merged);
incrementalResult = mergeMissing(group, incrementalResult, toMergePath, "downloaded", this::downloadMissing);
contributingMembers.addAll(incrementalResult.merged);
incrementalResult = mergeMissing(group, incrementalResult, toMergePath, "generated", this::generateMissing);
contributingMembers.addAll(incrementalResult.merged);
if (metadataProviders != null) {
master = mergeProviderMetadata(group, incrementalResult.result, toMergePath);
} else {
master = incrementalResult.result;
}
if (!incrementalResult.missing.isEmpty()) {
logger.warn("After download and generation attempts, metadata is still missing from the following stores: {}, size: {}", incrementalResult.missing, incrementalResult.missing.size());
}
Versioning versioning = master.getVersioning();
List<String> versions = versioning.getVersions();
logger.debug("Get versioning, versions: {}, release: {}, latest: {}", versions, versioning.getRelease(), versioning.getLatest());
if (versions != null && !versions.isEmpty()) {
merger.sortVersions(master);
return master;
}
List<SnapshotVersion> snapshotVersions = versioning.getSnapshotVersions();
if (snapshotVersions != null && !snapshotVersions.isEmpty()) {
if (logger.isTraceEnabled()) {
snapshotVersions.forEach(snapshotVersion -> logger.trace("snapshotVersion: {}", snapshotVersion.getVersion()));
}
return master;
}
List<Plugin> plugins = master.getPlugins();
if (plugins != null && !plugins.isEmpty()) {
return master;
}
logger.info("The group metadata generation is not successful for path: {} in group: {}", path, group);
return null;
}
use of org.apache.maven.artifact.repository.metadata.Plugin in project indy by Commonjava.
the class MetadataMarshaller method readFrom.
@Override
public Metadata readFrom(ProtoStreamReader reader) throws IOException {
Metadata md = new Metadata();
md.setModelVersion(reader.readString("modelVersion"));
md.setGroupId(reader.readString("groupId"));
md.setArtifactId(reader.readString("artifactId"));
md.setVersion(reader.readString("version"));
md.setPlugins(reader.readCollection("plugins", new ArrayList<Plugin>(), Plugin.class));
md.setVersioning(reader.readObject("versioning", Versioning.class));
md.setModelEncoding(reader.readString("modelEncoding"));
return md;
}
Aggregations