VersionRangeRequest request, Metadata.Nature nature )
{
Map<String, ArtifactRepository> versionIndex = new HashMap<String, ArtifactRepository>();
Metadata metadata =
new DefaultMetadata( request.getArtifact().getGroupId(), request.getArtifact().getArtifactId(),
MAVEN_METADATA_XML, nature );
List<MetadataRequest> metadataRequests = new ArrayList<MetadataRequest>( request.getRepositories().size() );
for ( RemoteRepository repository : request.getRepositories() )
{
MetadataRequest metadataRequest = new MetadataRequest( metadata, repository, request.getRequestContext() );
metadataRequest.setDeleteLocalCopyIfMissing( true );
metadataRequests.add( metadataRequest );
}
List<MetadataResult> metadataResults = metadataResolver.resolveMetadata( session, metadataRequests );
WorkspaceReader workspace = session.getWorkspaceReader();
if ( workspace != null )
{
List<String> versions = workspace.findVersions( request.getArtifact() );
for ( String version : versions )
{
versionIndex.put( version, workspace.getRepository() );
}
}
LocalRepositoryManager lrm = session.getLocalRepositoryManager();
File localMetadataFile = new File( lrm.getRepository().getBasedir(), lrm.getPathForLocalMetadata( metadata ) );
if ( localMetadataFile.isFile() )
{
metadata = metadata.setFile( localMetadataFile );
Versioning versioning = readVersions( session, metadata, result );
for ( String version : versioning.getVersions() )
{
if ( !versionIndex.containsKey( version ) )
{