ProjectVersionMetadata versionMetadata = null;
artifacts = new LinkedHashMap<String, List<Artifact>>();
List<String> repos = getObservableRepos();
MetadataResolver metadataResolver = session.getResolver();
for ( String repoId : repos )
{
if ( versionMetadata == null )
{
// we don't want the implementation being that intelligent - so another resolver to do the
// "just-in-time" nature of picking up the metadata (if appropriate for the repository type) is used
try
{
versionMetadata =
metadataResolver.resolveProjectVersion( session, repoId, groupId, artifactId, version );
if ( versionMetadata != null )
{
MetadataFacet repoProbFacet;
if ( ( repoProbFacet = versionMetadata.getFacet( RepositoryProblemFacet.FACET_ID ) ) != null )
{
addIncompleteModelWarning( "Artifact metadata is incomplete: "
+ ( (RepositoryProblemFacet) repoProbFacet ).getProblem() );
//set metadata to complete so that no additional 'Artifact metadata is incomplete' warning is logged
versionMetadata.setIncomplete( false );
}
}
}
catch ( MetadataResolutionException e )
{
addIncompleteModelWarning( "Error resolving artifact metadata: " + e.getMessage() );
// TODO: need a consistent way to construct this - same in ArchivaMetadataCreationConsumer
versionMetadata = new ProjectVersionMetadata();
versionMetadata.setId( version );
}
if ( versionMetadata != null )
{
repositoryId = repoId;
List<ArtifactMetadata> artifacts;
try
{
artifacts = new ArrayList<ArtifactMetadata>(
metadataResolver.resolveArtifacts( session, repoId, groupId, artifactId, version ) );
}
catch ( MetadataResolutionException e )
{
addIncompleteModelWarning( "Error resolving artifact metadata: " + e.getMessage() );
artifacts = Collections.emptyList();